func getCurrectLocationInfo()-> String {
var strFormattedAddress : String = ""
locationManager.requestWhenInUseAuthorization()
var currentLoc: CLLocation!
if(CLLocationManager.authorizationStatus() == .authorizedWhenInUse ||
CLLocationManager.authorizationStatus() == .authorizedAlways) {
currentLoc = locationManager.location
print(currentLoc.coordinate.latitude)
print(currentLoc.coordinate.longitude)
let latString = String(currentLoc.coordinate.latitude)
let longString = String(currentLoc.coordinate.longitude)
}
self.getaddress(pdblLatitude: latString, withLongitude: longString) { address in
print(address)
strFormattedAddress = address
return strFormattedAddress
}
}
How to return the current lat long of the user asynchronously. Please guide. Here in above code it is returning empty string