Built-in location engines
The Location module contains a
LocationEngine interface that provides location updates to other modules of the Maps and Navigation SDKs. Those modules can subscribe to continue to receive location updates. You can also implement your own
LocationEngine. See the instructions in the Custom Location Engine guide.
The Location module provides a predefined set of location engines:
DefaultCLLocationEngine– based on on the Apple
SimulatedLocationEngine- Simulates updates for testing purposes and previewing routes. Read more in the Simulation guide.
Learn how to set up a project and add these location engine dependencies in the Quickstart.
Accuracy is set to the highest possible level, which uses additional sensor data to facilitate navigation apps.
The minimum distance (expressed in meters) a device must move horizontally before an update event is generated is set to the
kCLDistanceFilterNone value. This constant indicates that all movement should be reported.
DefaultCLLocationEngine object does not require any parameters to be provided.
let defaultLocationEngine: LocationEngine = DefaultCLLocationEngine()
DefaultCLLocationEngine provides the
DefaultLocationValidator class for checking if the location is fixed or not. If you want to set a custom validator, you have to create the object which adopts the
LocationValidator protocol and pass this object to the engine.
let validationPolicy: LocationUpdateValidationPolicy = validationPolicylet defaultLocationEngine: LocationEngine = DefaultCLLocationEngine(locationValidationPolicy: validationPolicy)