Instance Property

showsUserLocation

A Boolean value indicating whether the map should try to display the user’s location.

Declaration

var showsUserLocation: Bool { get set }

Discussion

This property does not indicate whether the user’s position is actually visible on the map, only whether the map view should try to display it. Setting this property to true causes the map view to use the Core Location framework to find the current location and try to display it on the map. As long as this property is true, the map view continues to track the user’s location and update it periodically. The default value of this property is false.

Showing the user’s location does not guarantee that the location is visible on the map. The user might have scrolled the map to a different point, causing the current location to be offscreen. To determine whether the user’s current location is currently displayed on the map, use the isUserLocationVisible property.

See Also

Displaying the User’s Location

var isUserLocationVisible: Bool

A Boolean value indicating whether the device’s current location is visible in the map view.

var userLocation: MKUserLocation

The annotation object representing the user’s current location.

var userTrackingMode: MKUserTrackingMode

The mode used to track the user location.

func setUserTrackingMode(MKUserTrackingMode, animated: Bool)

Sets the mode used to track the user location with optional animation.