LocationProvider
public protocol LocationProvider : AnyObject
LocationProvider protocol used for providing a CLLocation for TomTomMap
.
The location provider additionally facilitates the delivery of location updates to other modules within the
Maps and Navigation SDKs; modules can add observers to receive location updates.
For MapView
, TomTom provides an implementation based on CLLocationManager
. The default implementation can be replaced using:
mapView.map.locationProvider = engine
Note
TheLocationProvider
protocol is responsible for providing location information but does not handle location authorization. It is the responsibility of the client to request and handle location authorization separately.
-
Enables the location provider. Might be called from private queue.
Declaration
Swift
func enable()
-
Disables location provider. Might be called from private queue.
Declaration
Swift
func disable()
-
The last location received. Will be nil until a location has been received.
Declaration
Swift
var lastKnownLocation: GeoLocation? { get }
-
Adds the
LocationUpdateObserver
which will be notified about location updates.Declaration
Swift
func addObserver(_ observer: LocationUpdateObserver)
Parameters
observer
A class that can handle location updates.
-
Remove observer from the location engine. Removes the
LocationUpdateObserver
which will be notified about location updates.Declaration
Swift
func removeObserver(_ observer: LocationUpdateObserver)
Parameters
observer
A class that can handle location updates.