How to get Coordinates from Google Places API in ios Swift

AAA picture AAA · Jan 6, 2016 · Viewed 7.8k times · Source

I am using Alamofire and SwiftyJSON to auto complete Google Places. I integrated it well and good like this :

enter image description here

Now, what I need is if I select a place from the table view, it is selected in the text field. But how can I get the respective latitude and longitude of that place, so that I can add annotation of that place in MapKit

Is it legal to get details from Google Place API and display them on apple's MapKit? I got this doubt after seeing Viking's question

Answer

nikhil nangia picture nikhil nangia · Aug 21, 2016

Maybe i m bit late but stil as a tuttorial i m posting this answer you can simply get the coordinates like this

// Handle the user's selection 

public func viewController(viewController: GMSAutocompleteViewController, didAutocompleteWithPlace place: GMSPlace) {
    var lat = place.coordinate.latitude
    var lon = place.coordinate.longitude
    print("lat lon",lat,lon)

}