Created
November 24, 2020 05:17
-
-
Save amixpal/b83347d42be1e352f7007c6d00c413ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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