Post

Replies

Boosts

Views

Activity

Reply to visionOS 26.0 beta does not call .onTapGesture
Thanks for the reply. I tried putting the WebViewView inside the Tab, but it still did not work. The essential problem was that I was using a WebViewView wrapped in a UIViewRepresentable inside a WebViewView. As a solution, I added the following UITapGestureRecognizer in the makeUIView of the WebView wrapped in UIViewRepresentable. let tap = UITapGestureRecognizer( target: context.coordinator, action: #selector(Coordinator.didTap(_:)) ) tap.cancelsTouchesInView = false tap.delegate = context.coordinator webView.addGestureRecognizer(tap) We also added the following methods to class Coordinator: NSObject, WKNavigationDelegate, WKScriptMessageHandler, and UIGestureRecognizerDelegate. @objc func didTap(_ sender: UITapGestureRecognizer) { parent.viewModel.userDidInteract = true } @objc func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer,. shouldRecognizeSimultaneouslyWith other: UIGestureRecognizer) -> Bool { true }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’25