PassiveLocationDataSource
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 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. 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.
Postcondition
Call
startUpdatingLocation()afterwards to begin receiving location updates.Declaration
Swift
public required init(directions: Directions = Directions.shared, systemLocationManager: NavigationLocationManager? = nil, tileStoreLocation: TileStoreConfiguration.Location = .default)Parameters
directionsThe directions service that allows the location data source to access road network data. If this argument is omitted, the shared
Directionsobject is used.systemLocationManagerThe location manager that provides raw locations for the receiver to match against the road network.
tileStoreLocationConfiguration of
TileStorelocation, where Navigation tiles are stored. -
The directions service that allows the location data source to access road network data.
Declaration
Swift
public let directions: Directions -
The location manager that provides raw locations for the receiver to match against the road network.
Declaration
Swift
public let systemLocationManager: NavigationLocationManager -
A
TileStoreinstance used by navigatorDeclaration
Swift
open var navigatorTileStore: TileStore { get } -
The location data source’s delegate.
Declaration
Swift
public weak var delegate: PassiveLocationDataSourceDelegate? -
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.
Declaration
Swift
public func startUpdatingLocation() -
A custom configuration for electronic horizon observations.
Set this property to
nilto use the default configuration.Declaration
Swift
public var electronicHorizonOptions: ElectronicHorizonOptions? { get set } -
The road graph that is updated as the passive location data source tracks the user’s location.
Declaration
Swift
public var roadGraph: RoadGraph { get } -
The road objects store that is updated as the passive location data source tracks the user’s location.
Declaration
Swift
public var roadObjectsStore: RoadObjectsStore { get } -
Manually sets the current location.
This method stops any automatic location updates.
Declaration
Swift
public func updateLocation(_ location: CLLocation?) -
Path to the directory where history could be stored when
PassiveLocationDataSource.writeHistory(completionHandler:)is called.Declaration
Swift
public static var historyDirectoryURL: URL? { get set } -
A closure to be called when history writing ends.
Declaration
Swift
public typealias WriteHistoryCompletionHandler = (_ historyFileURL: URL?) -> VoidParameters
historyFileURLA path to file, where history was written to.
-
Store history to the directory stored in
PassiveLocationDataSource.historyDirectoryURLand asynchronously run a callback when writing finishes.Declaration
Swift
public static func writeHistory(completionHandler: @escaping WriteHistoryCompletionHandler)Parameters
completionA block object to be executed when history writing ends.
-
Keys in the user info dictionaries of various notifications posted by instances of
See morePassiveLocationDataSource.Declaration
Swift
public struct NotificationUserInfoKey : Hashable, Equatable, RawRepresentable
Install in Dash
PassiveLocationDataSource Class Reference