why does my function's body get executed only one time although I put the body inside for loop that should be executed 7 times?
my lines of code is as follow
override func viewDidLoad() {
super.viewDidLoad()
getLocationFromGeoCoding()
}
func getLocationFromGeoCoding() {
for index in 0...6{
geoCoder.reverseGeocodeLocation(sevenWorldWonderOb[index].location ?? CLLocation()) {[weak self] (placemarks, err) in
if let err = err {
print("Error",err.localizedDescription)
return
}else {
guard let placemark = placemarks?.first else {return}
let streetNumber = placemark.subThoroughfare
let street = placemark.thoroughfare
let city = placemark.locality
let state = placemark.administrativeArea
let country = placemark.country
let Address = "\(streetNumber == nil ? "" : streetNumber!) \(street == nil ? "" : street!) \(city == nil ? "" : city!) \(state == nil ? "" : state!) \(country == nil ? "" : country!)"
self?.addressLocation.append(Address)
self?.wonderAddress.text = self?.addressLocation[index]
}
}
}
}