I have this code to open Google Maps App with specific location and it\'s working but what I need is to drop a pin on that location, is it possible ?
if (UIA
First open Info.plist
as Source Code (Righ Click on file Info.plis, then select Source Code) and add this:
LSApplicationQueriesSchemes
googlechromes
comgooglemaps
Next to make it easier to open Google Maps, create function like this one:
func openGoogleMaps() {
if (UIApplication.shared.canOpenURL(URL(string:"comgooglemaps://")!)) {
UIApplication.shared.openURL(URL(string:
"comgooglemaps://?center=\(myLatitude),\(myLongitude)&zoom=14&views=traffic")!)
} else {
print("Can't use comgooglemaps://")
}
}
Whenever you want to open Google Maps with given coordinate, you just call the function openGoogleMaps()
.
For more check Maps URLs and Maps SDK for iOS