TomTomSDKLocationProvider

TomTomSDKLocationProvider

The LocationProvider module facilitates the delivery of location information within the TomTom Maps and Navigation SDKs. It provides functionality for obtaining real-time location updates and ensures that other modules can access this information effectively.

Functionalities
  • LocationProvider provides a CLLocation for the TomTomMap, enabling accurate and timely location data for navigation.
  • LocationUpdateObserver allows other components to receive location updates, ensuring that all relevant modules have access to current location information.
  • DefaultCLLocationProvider implements the LocationProvider protocol using CLLocationManager as the GPS source. This implementation ensures reliable location updates based on GPS data.
  • LocationUpdateValidator defines the policy for validating incoming location updates. The DefaultLocationValidator class serves as the default implementation for this validation, ensuring that only valid location data is processed.
  • LocationEngineProviderType specifies the types of location sources, such as GNSS satellites and programmatically calculated locations based on road speed profiles.


API Overview

  • Implementation of LocationProvider that uses CLLocationManager as a GPS source provider. Provides location updates and manages location-related services.

    This class is responsible for providing GPS location updates using the CLLocationManager. The class includes:

    • enable location and disable location updates
    • manage observers and
    • validate location updates.

      Important

      This is a Public Preview API. It may be changed or removed at any time.
    See more

    Declaration

    Swift

    public class DefaultCLLocationProvider : NSObject, ValidatingLocationProvider
  • Indicates if GPS is fixed or not as a result of LocationValidator. Helps in determining the GPS status of the device, which can be either fixed or non-fixed.

    See more

    Declaration

    Swift

    public enum GPSStatus
  • A wrapper for the CLLocation class, encapsulating additional metadata for a location.

    Provides a more detailed representation of a location by including heading, provider type, and GPS status. Use this struct to enhance the information provided by a simple CLLocation object.

    See more

    Declaration

    Swift

    public struct GeoLocation
  • The source that provides the location.

    This enum defines the various sources that can provide location data for the GeoLocation struct. It includes two types: gnss (Global Navigation Satellite System), which represents location data from GNSS satellites, and softDR, which represents location data that is programmatically calculated.

    See more

    Declaration

    Swift

    public enum LocationEngineProviderType
  • Part of the MapMatchingResult that represents a single matched position candidate.

    This struct encapsulates information about a position that has been matched to the map, including its location, an identifier, a probability score, and other relevant details. It is used in map matching results to provide detailed information about each matched position candidate.

    See more

    Declaration

    Swift

    public struct MatchedLocation
  • Declares an observer that can receive location updates.

    The LocationUpdateObserver protocol is used to notify observers when a new location is available. Any object that wants to receive location updates should conform to this protocol and implement the didUpdateLocation method. This allows the observer to use the updated location for various purposes such as updating UI, navigation, etc.

    See more

    Declaration

    Swift

    public protocol LocationUpdateObserver : Observer
  • 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

    The LocationProvider 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.
    See more

    Declaration

    Swift

    public protocol LocationProvider : AnyObject
  • The SimulatedLocationProvider provides simulated location updates to simulate driving on GPX/TTP tracks or route geometry.

    When used in DefaultTomTomNavigation and it’s locations are generated from route geometry, please also set the same location provider in TomTomMap. If not, then the navigation experience might not be smooth.

    Important

    This is a Public Preview API. It may be changed or removed at any time.
    See more

    Declaration

    Swift

    public class SimulatedLocationProvider : ValidatingLocationProvider
  • Defines the policy for validating incoming location updates.

    The LocationUpdateValidator protocol specifies a method for validating incoming location updates. Implementations of this protocol can define custom validation logic to determine whether a new location update is valid based on the provided new and last known locations.

    See more

    Declaration

    Swift

    public protocol LocationUpdateValidator
  • LocationValidator defines the interface for checking the validity of the location.

    The LocationValidator protocol provides a method for validating a given location. Implementations of this protocol can define custom validation logic to determine whether a location is considered fixed (valid) or not based on the provided location and its source.

    See more

    Declaration

    Swift

    public protocol LocationValidator
  • DefaultLocationValidator is the default implementation of LocationValidator.

    The DefaultLocationValidator class provides a default implementation for validating locations based on their horizontal accuracy. If the accuracy is within an acceptable range, the location is considered valid (GPS fixed), otherwise it is considered invalid (GPS not fixed).

    See more

    Declaration

    Swift

    public class DefaultLocationValidator : LocationValidator