import CoreLocation
func ConvertAddress(address: String) -> [Double] {
let geocoder = CLGeocoder()
var lat: Double = 0
var lng: Double = 0
geocoder.geocodeAddressString(address) { placemarks, error in
let placemark = placemarks?.first
lat = placemark?.location?.coordinate.latitude ?? 0
lng = placemark?.location?.coordinate.longitude ?? 0
}
return [lat, lng]
}
ConvertAddress(address: "서원구 수곡로 57번길 32-2(수곡동)")
I checked result has right lat, lng value. But when i use return, using func the values are [0,0] How can i get lat, lng?