TPEGTrafficService

public class TPEGTrafficService : TrafficService
extension TPEGTrafficService: OnStoreAccessChangedObserver
extension TPEGTrafficService: LocationProviderObservable

Reacts on and controls TPEG traffic provider behavior.

Important

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

Initializer

Public

  • Important

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

    Declaration

    Swift

    public var isConnected: Bool { get }
  • Important

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

    Declaration

    Swift

    public var trafficEventCount: Int { get }
  • Important

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

    Declaration

    Swift

    public var trafficInterface: UnsafeMutableRawPointer? { get }
  • Important

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

    Declaration

    Swift

    public func updateCurrentPosition(_ position: CLLocationCoordinate2D) throws
  • Important

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

    Declaration

    Swift

    public func updateRoutesForTraffic(_ routes: [[CLLocationCoordinate2D]]) throws
  • Important

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

    Declaration

    Swift

    public func updateLocale(_ locale: Locale)
  • trafficEvents(for:) Asynchronous

    Gets trafficEvents.

    Important

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

    Throws

    An error if cannot get TrafficEvents.

    Declaration

    Swift

    public func trafficEvents(
        for boundingBox: TomTomSDKCommon.BoundingBox
    ) async throws -> [TomTomSDKCommon.TrafficEvent]

    Parameters

    boundingBox

    The area to look for the TrafficEvents.

    Return Value

    Array of TrafficEvents within the given boundingBox.

  • Asynchronously calls a completion callback with a result containing TrafficEvents within the given boundingBox, or an error.

    Important

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

    Declaration

    Swift

    public func getTrafficEvents(
        for boundingBox: TomTomSDKCommon.BoundingBox,
        completion: @escaping (Result<[TomTomSDKCommon.TrafficEvent], Error>) -> ()
    )

    Parameters

    boundingBox

    The area to look for the TrafficEvents.

    completion

    The completion handler to call with the result. The handler is executed on a background thread.

  • Adds observer.

    Important

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

    Important

    An attempt to add an observer from the onTrafficUpdated() implementation of a registered observer will result in a deadlock.

    Declaration

    Swift

    public func addObserver(_ observer: TrafficUpdateObserver)

    Parameters

    observer

    An instance of TrafficUpdateObserver to add.

  • Removes observer.

    Important

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

    Important

    An attempt to remove an observer from the onTrafficUpdated() implementation of a registered observer will result in a deadlock.

    Declaration

    Swift

    public func removeObserver(_ observer: TrafficUpdateObserver)

    Parameters

    observer

    An instance of TrafficUpdateObserver to remove.

  • Important

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

    Declaration

    Swift

    public func notifyMapLoaded()
  • Important

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

    Declaration

    Swift

    public func notifyMapUnloading()
  • Important

    This is a Public Preview API. It may be changed or removed at any time. Sets a new location engine.

    Declaration

    Swift

    public func updateLocationProvider(_ locationProvider: LocationProvider)

    Parameters

    locationProvider

    The new LocationProvider.

OnStoreAccessChangedObserver

  • Important

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

    Declaration

    Swift

    public var onStoreAccessChangedObserverId: String { get }
  • Important

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

    Declaration

    Swift

    public func onReadOnlyAccessGranted(mapChanged: Bool)
  • Important

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

    Declaration

    Swift

    public func onReadOnlyAccessReleaseRequested(accessReleased: @escaping () -> ())

LocationProviderObservable

  • Important

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

    Declaration

    Swift

    public func onAuthorizationStatusChanged(isGranted: Bool)
  • Important

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

    Declaration

    Swift

    public func onHeadingUpdate(newHeading _: CLHeading, lastLocation _: GeoLocation)
  • Important

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

    Declaration

    Swift

    public func onLocationUpdated(location: GeoLocation)