I hope this is relevant to this forum,
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?
xwu
(Xiaodi Wu)
2
Hi @ShadyElyaski ! Apple has asked that questions about their proprietary frameworks, of which SwiftUI is one, be asked over in their developer forums and not here. There’s a chance you’ll find a community member here who can help with the question nonetheless, though, but since you asked I’d point out that it’s not considered to be “on-topic.”
1 Like