PassiveLocationManager
open class PassiveLocationManager : NSObject, LocationProvider
extension PassiveLocationManager: PassiveLocationDataSourceDelegate
An object that notifies a map view when the user’s location changes, minimizing the noise that normally accompanies location updates from a CLLocationManager
object.
Unlike Router
classes such as RouteController
and LegacyRouteController
, this class operates without a predefined route, matching the user’s location to the road network at large. If your application displays a MapView
before starting turn-by-turn navigation, call LocationManager.overrideLocationProvider(with:)
to override default location provider so that the map view always shows the location snapped to the road network. For example, use this class to show the user’s current location as they wander around town.
This class depends on PassiveLocationDataSource
to detect the user’s location as it changes. If you want location updates but do not need to display them on a map and do not want a dependency on the MapboxNavigation module, you can use PassiveLocationDataSource
instead of this class.
-
Initializes the location manager with the given data source.
Declaration
Swift
public init(dataSource: PassiveLocationDataSource)
Parameters
dataSource
A data source that detects the user’s location as it changes.
-
The location manager’s delegate.
Declaration
Swift
public weak var delegate: LocationProviderDelegate?
-
The location manager’s data source, which detects the user’s location as it changes.
Declaration
Swift
public let dataSource: PassiveLocationDataSource
-
Declaration
Swift
public var authorizationStatus: CLAuthorizationStatus { get }
-
Declaration
Swift
public func requestAlwaysAuthorization()
-
Declaration
Swift
public func requestWhenInUseAuthorization()
-
Declaration
Swift
public var locationProviderOptions: LocationOptions
-
Declaration
Swift
public var accuracyAuthorization: CLAccuracyAuthorization { get }
-
Declaration
Swift
public var heading: CLHeading? { get }
-
Declaration
Swift
public func setDelegate(_ delegate: LocationProviderDelegate)
-
Declaration
Swift
@available(iOS 14.0, *) public func requestTemporaryFullAccuracyAuthorization(withPurposeKey purposeKey: String)
-
Declaration
Swift
public func startUpdatingLocation()
-
Declaration
Swift
public func stopUpdatingLocation()
-
Declaration
Swift
public var headingOrientation: CLDeviceOrientation { get set }
-
Declaration
Swift
public func startUpdatingHeading()
-
Declaration
Swift
public func stopUpdatingHeading()
-
Declaration
Swift
public func dismissHeadingCalibrationDisplay()
-
Declaration
Swift
@available(iOS 14.0, *) public func passiveLocationDataSourceDidChangeAuthorization(_ dataSource: PassiveLocationDataSource)
-
Declaration
Swift
public func passiveLocationDataSource(_ dataSource: PassiveLocationDataSource, didUpdateLocation location: CLLocation, rawLocation: CLLocation)
-
Declaration
Swift
public func passiveLocationDataSource(_ dataSource: PassiveLocationDataSource, didUpdateHeading newHeading: CLHeading)
-
Declaration
Swift
public func passiveLocationDataSource(_ dataSource: PassiveLocationDataSource, didFailWithError error: Error)