how cat get coordinate location of didUpdateLocation delegate ?
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
Please Help me.Thanks
how cat get coordinate location of didUpdateLocation delegate ?
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
Please Help me.Thanks
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
location = locations.last!
}
Please do some research before posting.
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let coordinate = locations.first?.coordinate
}
The location manager gives you an array of locations, just get the first one and then access the coordinate property.
the simple answer for this question in swift :