Here I have this Rectangle, how could I read the x location of tap on Rectangle?
struct ContentView: View {
var body: some View {
Rectangle()
.fill(Color.blue)
.frame(height: 50, alignment: .center)
.padding()
.onTapGesture {
print("location of tap on Rec is = ???")
}
}
}
update:
Rectangle()
.fill(Color.blue)
.frame(height: 50, alignment: .center)
.padding()
.onLongPressGesture(minimumDuration: 0.01, maximumDistance: 0) {
print("onLongPressGesture!")
}