Issue #309
Apple Maps
let placemark = MKPlacemark(coordinate: coordinate, addressDictionary: nil)
let mapItem = MKMapItem(placemark: placemark)
mapItem.name = shop.name
mapItem.openInMaps(launchOptions: [:])
Google Maps
- https://developers.google.com/maps/documentation/urls/ios-urlscheme
- Use
q
to show pin
Since iOS 9, we need to declare LSApplicationQueriesSchemes
<key>LSApplicationQueriesSchemes</key>
<array>
<string>comgooglemaps</string>
</array>
var string = "comgooglemaps://"
string += "?q=Food"
string += "¢er=\(coordinate.latitude),\(coordinate.longitude)"
string += "&zoom=15"
let googleUrl = URL(string: string)!
if UIApplication.shared.canOpenURL(URL(string: "comgooglemaps://")!) {
UIApplication.shared.open(googleUrl)
}