Post

Replies

Boosts

Views

Activity

How to disable multiple TapGestures from being recognized simultaneously in SwiftUI
I'm trying to build a simple List in SwiftUI, each row will perform an action on tap, here's a sample code: struct ContentView: View { var body: some View { List { ForEach(1..<10) { i in Text("Hello, world!") .onTapGesture { print("Tapped: ", i) } } } } } This works, however, if user multi-taps on two rows, the console is going to print twice. Not great if I'm pushing a secondary view controller. Is there a way to have some sort of exclusiveTouch property to each List item, similar to what is in UIKit?
3
0
1.4k
Oct ’22