SwiftUI: Cancel TapGesture on parent view
问题 I have view hierarchy in SwiftUI like ParentView { //other views ChildView().highPriorityGesture(TapGesture().onEnded { print("Tap!") }) // other views }self.gesture(tap) And I want to have parent view handle all taps on the screen in spite of cases when user taps onto ChildView. Now both closures executes. How to stop tap gesture events propagating up view hierarchy? 回答1: Well, probably there is some specific in which exactly ChildView and ParentView , because as tested below (Xcode 11.2 /