struct ContentView: View {
var body: some View {
VStack {
Circle()
.fill(.red)
.frame(width: 200, height: 200)
.onTapGesture {
print("Circle tapped")
}
}
.onTapGesture {
print("VStack tapped")
}
}
}
.onTapGesture allows to tap only layer of design but .simultaneousGesture identify and allows touch to multiple layer
struct ContentView: View {
var body: some View {
VStack {
Circle()
.fill(.red)
.frame(width: 200, height: 200)
.onTapGesture {
print("Circle tapped")
}
}
.simultaneousGesture(
TapGesture()
.onEnded { _ in
print("VStack tapped")
}
)
}
}