GMSReverseGeocodeResponse contains
- (GMSReverseGeocodeResult *)firstResult;
whose definition is like:
@interf
In swift 4.0 the func gets CLLocation and return postal address
func geocodeCoordinates(location : CLLocation)->String{
var postalAddress = ""
let geocoder = GMSGeocoder()
geocoder.reverseGeocodeCoordinate(location.coordinate, completionHandler: {response,error in
if let gmsAddress = response!.firstResult(){
for line in gmsAddress.lines! {
postalAddress += line + " "
}
return postalAddress
}
})
return ""
}