Contents

mapView(_:didUpdate:)

Tells the delegate when the map view updates the user’s location.

Declaration

optional func mapView(_ mapView: MKMapView, didUpdate userLocation: MKUserLocation)

Parameters

  • mapView:

    The map view that’s tracking the user’s location.

  • userLocation:

    The location object representing the user’s latest location. This property may be nil.

Mentioned in

Discussion

While the showsUserLocation property is true, the map view calls this method whenever it receives a new location update. It also calls this method if the map view’s user-tracking mode is MKUserTrackingMode.followWithHeading and the heading changes.

The.map view doesn’t call this method if the app is running in the background. If you want to receive location updates while running in the background, use the Core Location framework.

See Also

Tracking the user’s location