The onTapGesture that returns a point is deprecated and only return screen coord.
So my question is how to take the x,y and get Lat/Long
Multiline
VStack {
Map()
// .onTapGesture {
// print("onTapGesture")
// }
// .onTapGesture(perform: {
// print ("onTapperform")
// })
.onTapGesture(perform: { pt in
print(pt)
})
BlockQuote
The current version I could add MKMapViewDelegate to my MapView
Multiline
@objc func handleTap(sender: UITapGestureRecognizer) {
guard sender.state == .ended else { return }
let locationInView = sender.location(in: parent.vm.mapView)
let tappedCoordinate = parent.vm.mapView.convert(locationInView, toCoordinateFrom: parent.vm.mapView)
}
BlockQuote
Can you provide me the iOS17/Xcode 15?
Topic:
App & System Services
SubTopic:
Maps & Location
Tags: