TomTomSDKTraffic
TomTomSDKTraffic
The TomTom Traffic module provides road traffic information, in the form of traffic incidents, for route calculation, visualization, and guidance use cases for both online and offline scenarios. The data availability depends on the provider offering and can be limited to a given radius of the current position, a route, a region, or a country.
-
Interface to the Traffic Data Provider.
Navigation SDK components use the Traffic interface to access traffic information. For example,
TomTomSDKRoutePlannerOffline.OfflineRoutePlanner
uses it to calculate routes that avoid traffic.An instance of this interface is created with
TomTomSDKTrafficEngine.TrafficFactory
.Once a traffic data provider instance is created and connected to a source of traffic, it will start receiving traffic data as offered by the provider. For example, near the current location, along the route, or for the current country/area. If a route is registered via the
Traffic.updateRoutesForTraffic
function, the traffic data provider will start receiving traffic information for the given route. When new traffic events are received, the traffic data provider will notify the user via theTrafficUpdateObserver
interface, provided that an observer is registered via theTraffic.addObserver
function. Users can fetch traffic in an area via theTraffic.trafficEvents
andTraffic.getTrafficEvents
functions.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol Traffic : AnyObject
-
Declares an observer that can receive traffic situation change events.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol TrafficUpdateObserver : AnyObject