Button Responsiveness Problems in SwiftUI Apps After Upgrading to iOS 18

I've been encountering significant issues with button responsiveness across my entire SwiftUI application after upgrading to iOS 18. While everything worked as expected on iOS 17, buttons across various views now sometimes fail to respond to initial taps and require a long press to trigger actions.

Here is a sample of a button within a toolbar, similar issues are occurring with other buttons throughout the app:

.toolbar {
    ToolbarItem(placement: .topBarLeading) {
        Button(action: {
            DispatchQueue.main.async {
                navigationCoordinator.pushScreen(.account)
            }
        }) {
            Image("User")
                .resizable()
                .scaledToFit()
                .frame(width: 24.5, height: 24.5)
        }
    }
}

Expected Behavior: All buttons in the application should respond to a simple tap without requiring additional user effort, maintaining consistency with their behavior on iOS 17.

Actual Behavior: On iOS 18, the responsiveness of buttons throughout the application is inconsistent; sometimes they react to a simple tap, and other times they only respond to a long press. This erratic behavior disrupts the user experience and hinders basic app functionality.

I am looking to understand whether this is a widespread issue with the new OS version and if there are any fixes or patches anticipated from Apple. Thank you for your assistance!

I have been having this issue when I build an app for work since using Xcode 16/16.1. If I build it with Xcode 15.4, there is no issue. I'm glad that long pressing works but agree it isn't ideal. I'm hoping for a fix as well. If I press other buttons or textfields that work, sometimes the unresponsive buttons may come back but others may break. Edit: My devices (iPhone and iPad) are running their respective 18.1 beta 6 OSes but has been an issue since only since building with Xcode 16/16.1 betas.

I'm still encountering the same error and hoping they will fix it soon I think you can replace your buttons or onTapGesture with .highPriorityGesture(TapGesture().onEnded({ _ in }) to see if it resolves the issue.

I am also facing this issue if I build the app on Xcode 16 and run it for iOS 18 device/simulator. The issue with responsiveness is only happening on 1 particular screen. I have checked the view hierarchies, any deprecated methods but nothing seems to clarify why its working on iOS 17 but not iOS 18

on iOS 18+, parentView's tapGesture may block childViews' tapGestures (.onTapGesture, or Button's action) -> solution: replace parentView's .onTapGesture with .simultaneousGesture

Indeed the issue appears when the parent view has onTapGesture or onLongPressGesture, and then buttons and sliders stop working. One approach is to use simultaneousGesture, where the issue is that a child view cannot prevent it from running.

In every sane framework, events propagate from child to parent, allowing the child to stop propagation. Apple being Apple think different and made it the other way around.

Example: if I want to use onTapGesture to hide the keyboard when a user taps outside a TextField, that's impossible. Why this behaviour is not the default is beyond me. The best approach for iOS 18 is simultaneousGesture with LongPressGesture, but that doesn't work on iOS 15 where a onLongPressGesture is required with a onTapGesture before it, just to keep the UI from breaking. Of course that does not work on iOS 18. On macOS a simple onTapGesture does the trick. A view modifier with conditional compilation does the trick.

Through some voodoo magic I found a way to discover if the current responder is a TextField and then I can hide it. But I can't find a way to detect if a tap is within a TextField or not.

Facing the same issue since upgrading to iOS 18.2 on a full SwiftUI application I am building for a client. I have told them to not upgrade to iOS 18 for now since we have not been seeing this issue at all on iOS 17?! Bizarrely not just occurring for custom back buttons, but custom buttons also seem to intermittently show the issue, with the issue being most obvious when a .fullScreenCover is presented. I really hope Apple release a fix for this as this is a serious blocker on iOS 18!!!

Button Responsiveness Problems in SwiftUI Apps After Upgrading to iOS 18
 
 
Q