I have latitude and longitude that I want to open into my map application. I tried this code from HERE.
func goToMap(){
var lat1 : NSString = self.v
The MKMapItem approach above works great if you want granular control over the information that is displayed in Maps.
Otherwise, the code below works great as well, :
// Open and show coordinate
let url = "http://maps.apple.com/maps?saddr=\(coord.latitude),\(coord.longitude)"
UIApplication.shared.openURL(URL(string:url)!)
// Navigate from one coordinate to another
let url = "http://maps.apple.com/maps?saddr=\(from.latitude),\(from.longitude)&daddr=\(to.latitude),\(to.longitude)"
UIApplication.shared.openURL(URL(string:url)!)
However, the code above does not let you to send in a custom name of the place. Instead, it will show the address.
The code above also lets you navigate from any source coordinate, which I don't know if you can do with the MKMapItem approach.