it won't accept it because there is already the action in the first part of the Button? It depends on the internal implementation of SwiftUI. We cannot say why, but it is clear under the current implementation of SwiftUI on iOS, the closure passed to onTapGesture is not executed.
Will it - the onTapGesture method - work for nfcWriteButton? UIViewRepresentable and hidden Coordinator are making things more complex, and it depends on how you define the word work. But as far as I tried, the closure passed to onTapGesture is called, but the target-action method is not.
Generally, you should better not write such fragile code, meaning depending on the implementation detail of the frameworks. Do not put onTapGesture on Button and write all things to do in the action closure
Add action closure to your nfcWriteButton (in Swift, type names should start with Capital letter) like Button
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: