How to get an address from coordinates using MapKit?
I have this code when long press on the map it gets the coordinates:
func didLongPressMap(sender
Swift 4.2 Keep it as simple as possible, look at the Apple doc and modify it as you need:
func retreiveCityName(lattitude: Double, longitude: Double, completionHandler: @escaping (String?) -> Void)
{
let geocoder = CLGeocoder()
geocoder.reverseGeocodeLocation(CLLocation(latitude: latitude, longitude: longitude), completionHandler:
{
placeMarks, error in
completionHandler(placeMarks?.first?.locality)
})
}