'Anybody got SwiftUI+MapKit+LongPress working?

I am trying to get SwiftUI + MapKit + LongPress gesture to work. When I add the map to the ContentView works great. I then add the .onLongPressGesture handler to the map, and the panning/zooming stops working. LONG PRESS WORKS though!

You can see my sample project at: https://github.com/tomha2014/KISS_MapKit_SwiftUI

but it goes like this:

           Map(coordinateRegion: $region, interactionModes: .all, showsUserLocation: true)
//                .onLongPressGesture {
//                    // How do I get the location (Lat/Long) I am pressed on?
//                    print("onLongPressGesture")
//                }

Also any body know how to get the lat/long when the press was made?

I think I could do this with a map controller, but this seems to be the "Modern" way, I just wished it was the document way.

Thanks Tom



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source