The Location module provides an interface for obtaining and working with location updates. It provides implementations for getting an actual user location with and without Apple Services, as well as one for simulating locations.
To use the Location module, you need to configure the project and add the dependencies.
Project set up
To use the Location SDK, you will need to do the following:
- Set up the project - Project set up guide.
- Once the project is set up, import the following frameworks:
Existing location providers
The Location module provides the basic
LocationProvider protocol. All location engines have to adopt this protocol. The Location module contains the following location engine implementations:
DefaultCLLocationProvider- relies on the Apple
SimulatedLocationProvider- simulates updates for testing purposes and previewing routes.
Learn more about existing location providers in the Built-in location providers.
Custom location providers
Within the TomTom SDKs, developers are not limited to the provided location providers and can use their own services to record locations, or develop their own custom simulated location updates. Read more about creating your own custom location provider in the Create your own provider guide.
LocationValidator defines the interface for checking if the location is fixed or not. The GPS fix status indicates the quality of the signal, or the accuracy and reliability of the location being reported. The Location module provides the
DefaultLocationValidator or developers can create the custom one.
If the application is going to use user location data, you have to request the correct permissions. In particular, the user must grant location permission before the location provider can be used. Complete instructions to request location permissions on iOS can be found at Requesting authorization for location services.
DefaultCLLocationProvider has the location authorization request from the box.