ios - How to open Google Maps to show route using Swift -
i read around internet couldn't find legit answer. need open google maps when user clicks button show directions. start , destination must automatically filled.
how can achieve in swift?
if has solution, please provide me sample code. start going user's current location.
ok found answer myself.
if want show directions user's current location, leave field saddr
blank , in field daddr
can enter destination coordinates.
this how did it
if (uiapplication.sharedapplication().canopenurl(nsurl(string:"comgooglemaps://")!)) { uiapplication.sharedapplication().openurl(nsurl(string: "comgooglemaps://?saddr=&daddr=\(place.latitude),\(place.longitude)&directionsmode=driving")!) } else { nslog("can't use comgooglemaps://"); } }
for further queries can refer link google map url scheme
Comments
Post a Comment