As GeoCoder is now deprecated I am struggling to get the country only information from the new MKReverseGeocoding. Maybe someone can guide me or give me direction? Or is this just not possible anymore?
let request = MKReverseGeocodingRequest(location: self.lastLocation ?? fallbackLocation)
request?.getMapItems { items, error in
guard let items = items else { return }
self.cityName = items.first?.addressRepresentations?.cityWithContext ?? ""
self.countryName = items.first?.addressRepresentations?.regionName ?? ""
}
I couldn't find anything here, sure you can get the full Address but I need single values to store so the user can search for (example City, Country) In case the structure is always the same, let us say the country is always third part, sure I could split the string but it is not a reliable way to do this, at least for me.
Any help would be much appreciated.