Reputation: 114
I have a view that will have two kinds of tap gestrures attached to it. Something like
view
.gesture(TapGesture().onEnded {...}) // <-- Don't fire this when shift is pressed
.simultaneousGesture(TapGesture().modifiers(.shift).onEnded {....})
How I prevent the first gesture to be fired when shift is pressed. Under all circumstances I want only one gesture to be fired.
applying both gestures on view like .gesture does not work The second one is not fired at all, under any circumstance.
Upvotes: 2
Views: 180
Reputation: 258375
Try to make second one with higher priority, like
view
.gesture(TapGesture().onEnded {...})
.highPriorityGesture(TapGesture().modifiers(.shift).onEnded {....})
Upvotes: 2