-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS 18 update #5
Comments
I am having the exact same issue, where the touches from the SwiftUI view are indeed ignored. Will this be fixed soon? It does show me how brittle the communication between SwiftUI and UIKit can become, and I am glad the code is currently not in production for us, else those views would have stopped working in iOS 18. Maybe mixing both of them inside the same view is not the best idea, this might happen in the future once more. |
Find a solution? Here's a related thread https://forums.developer.apple.com/forums/thread/762292 with a potential solution at the end |
Yeah I ended up using a separate UIWindow like the one in the Apple dev thread |
Hi guys, I found a solution that worked for me, and might possibly work for you as well.
on iOS 18 the resulting hittest should contain a UIHostingView, if it does we do the checkBehind logic. It it returns nil, you return the result since you are touching inside the SwiftUI view. If it returns a value, you know you are touching a view behind the UIHostingView. Tested it inside our project, and it now does what it is supposed to do. Hope this helps someone |
The solution doesn't work on iOS 18, I'm in the process of figuring out why, but will throw this issue in just in case some good samaritan has already done it and would like to share the fix :))
Something changed in the hitTesting logic and now the SwiftUI views contained in the UIHostingController's rootView are not interactive.
Bare bones example:
Tapping the button in the
DummyView
propagates the touch down into UIKit, not triggering the SwiftUI button actionThe text was updated successfully, but these errors were encountered: