open class PassiveLocationDataSource : NSObject
extension PassiveLocationDataSource: CLLocationManagerDelegate
An object that notifies its delegate when the user’s location changes, minimizing the noise that normally accompanies location updates from a
Router classes such as
LegacyRouteController, this class operates without a predefined route, matching the user’s location to the road network at large. You can use a passive location manager to determine a starting point for a route that you calculate using the
Directions.calculate(_:completionHandler:) method. If the user happens to be moving while you calculate the route, the passive location manager makes it less likely that the route will begin with a short segment on a side road or driveway and a confusing instruction to turn onto the current road.
To find out when the user’s location changes, implement the
PassiveLocationDataSourceDelegate protocol, or observe
Notification.Name.passiveLocationDataSourceDidUpdate notifications for more detailed information.
Initializes the location data source with the given directions service.
startUpdatingLocation(completionHandler:)afterwards to begin receiving location updates.
The directions service that allows the location data source to access road network data. If this argument is omitted, the shared
Directionsobject is used.
Starts the generation of location updates with an optional completion handler that gets called when the location data source is ready to receive snapped location updates.
public func startUpdatingLocation(completionHandler: ((Error?) -> Void)? = nil)
Manually sets the current location.
This method stops any automatic location updates.
public func updateLocation(_ location: CLLocation?)