I'm building an iOS app using MapKit, and CoreLocation. I can get the current location of the user by calling :
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.setupUI()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBest
self.mapView.delegate = self
self.locationManager.startUpdatingLocation()
self.mapView.showsUserLocation = true
geoCoder = CLGeocoder()
}
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let location: CLLocation = locations.last!
// self.addressView.text = "\(location.coordinate.latitude) \(location.coordinate.longitude)"
geoCode(location)
if (zoomed == false) {
zoomToUserLocationAnimated(true)
zoomed = true
}
}
But this function is called even when the user does not move. I'm using iOS simulator on OSX and I simulated a location, so I'm pretty sure the simulator does not move, but still this function is called, I'd like to know if there is a way to check if the user made an actual move ?
Thanks