open google maps and show direction from one place to another iOS swift.

Solution:

I had a button in my app.I want to open google maps and navigation to that location from my current location when the user clicks.


            if (UIApplication.shared.canOpenURL(URL(string:"comgooglemaps://")!)){
                UIApplication.shared.openURL(NSURL(string:
                    "comgooglemaps://?saddr=&daddr=\(lat),\(long)&directionsmode=driving")! as URL)
            } else{
                NSLog("Can't open com.google.maps://");
            }

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift