Skip to content

Instantly share code, notes, and snippets.

@amixpal
Created November 24, 2020 05:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amixpal/b83347d42be1e352f7007c6d00c413ae to your computer and use it in GitHub Desktop.
Save amixpal/b83347d42be1e352f7007c6d00c413ae to your computer and use it in GitHub Desktop.
geocoder.reverseGeocodeCoordinate(coordinate) { response, error in
guard
let address = response?.firstResult(),
let lines = address.lines
else {
return
}
var addressString : String = ""
if address.thoroughfare != nil {
addressString = addressString + address.thoroughfare! + ", "
}
if address.locality != nil {
addressString = addressString + address.locality! + ", "
}
if address.administrativeArea != nil {
addressString = addressString + address.administrativeArea! + ", "
}
self.addressText = addressString
self.lat = coordinate.latitude
self.lng = coordinate.longitude
self.resultView?.text = self.addressText
self.searchController.searchBar.text = self.addressText
self.continueButtonView.isEnabled = true
self.continueButtonView.backgroundColor = UIColor(red:0.13, green:0.83, blue:0.56, alpha:1.0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment