I used location in my app that will get latitude and longitude in the app and then can give me the name of the city that user is in the name is in English but I want to convert that to the Persian I found this method But this will work in iOS 11 But I am developing from ios9 how can I get print of the current city in Persian ? here I my codes
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if firstUpdate {
if let _latitude = locations.first?.coordinate.latitude {
if let _longitude = locations.first?.coordinate.longitude {
firstUpdate = false
self.locationManager.stopUpdatingLocation()
self.carregaDadosLocal(latitude: _latitude, longitude: _longitude)
let location = CLLocation(latitude: _latitude, longitude: _longitude)
if #available(iOS 11.0, *) {
CLGeocoder().reverseGeocodeLocation(location, preferredLocale: Locale(identifier: "fa_IR")) { (local, error) in
if (local?[0]) != nil {
print(local?[0].thoroughfare!)
print(local?[0].locality)
print(local?[0].location)
print(local?[0].subLocality)
}
}
} else {
// Fallback on earlier versions
}
}
}
}
}