SwiftUI: How to handle custom gesture recognizers without blocking default interactions?
I've been struggling with this for a few days now and could really use some help... I'm working on a SwiftUI application where I want to implement a custom gesture recognizer on a `ZStack` that contains multiple overlapping views. The goal is to detect a long press on a specific view while still allowing taps on the other views to trigger their default interactions. However, I'm facing an issue where adding the long press gesture seems to block touch events for the underlying views completely. I've tried using the `.simultaneousGesture` modifier, but that doesn't seem to work as expected. Here's a simplified version of my code: ```swift struct ContentView: View { var body: some View { ZStack { // Background View Color.blue .frame(height: 200) .onTapGesture { print("Background tapped!") } // Foreground View with Long Press Gesture Color.red .frame(height: 100) .gesture(LongPressGesture().onEnded { _ in print("Red view long pressed!") }) .simultaneousGesture(TapGesture().onEnded { print("Red view tapped!") }) } } } ``` With the current setup, when I long press the red view, I can successfully trigger the long press event, but I can no longer tap on the blue background. I’ve tried changing the order of gesture modifiers and experimenting with `.highPriorityGesture`, but it still results in the same behavior. I'm looking for a way to allow both the long press on the red view and the tap on the blue background without any issues. Is there a recommended pattern or modifier that I might be missing? Any help would be greatly appreciated! I'm working on a service that needs to handle this. What's the best practice here?