Search code examples
iosswiftgoogle-mapsgoogle-maps-sdk-ios

Open in Google Maps App when clicking on Google control button.. Swift 4


I'm using google maps SDK in swift 4, everything is perfect, but.. I need to allow the user to tap on Google control button as the image below:

Google control button image

My question is how to drop the a marker from my app map to google maps app with specific coordinates. Thanks.


Solution

  • As far as I know you cannot override that button.

    You're better off using a different button that opens a url. as per https://developer.apple.com/documentation/uikit/uiapplication/1648685-open

    You can then include the marker coordinates as a query in your url, which will add a marker to the map. eg. https://www.google.com/maps/search/?api=1&query=-33.830114,151.219235

    this is as per: https://developers.google.com/maps/documentation/urls/guide