TrafficVisualization
public protocol TrafficVisualization : AnyObject, ConformanceLocked
TrafficVisualization
defines the protocol for managing and interacting with traffic incident visualizations on a route map.
This protocol provides an interface for enabling/disabling traffic incident visualizations, retrieving traffic incidents for specific routes, and managing observers for tap events on traffic incidents.
Adds an observer to the list of tap observers.
This allows external entities to observe and respond to tap events on TrafficSection
s.
When a TrafficSection
is tapped, all registered observers are notified.
Important
This is a Public Preview API. It may be changed or removed at any time.
Declaration
Swift
func addTrafficIncidentTapObserver(_ observer: TrafficIncidentTapObserver)
Parameters
observer
|
An object that conforms to the |
Enables or disables visualization of on-route traffic incidents.
This properity can be changed at any moment of the TrafficVisualization
lifecycle.
For example, if it is called when no traffic incidents are available (e.g., before displaying a route plan), the new visibility status (either enabled or disabled) is saved and applied later when traffic incidents are available.
If it is called when traffic incidents are available (e.g., during the route planning phase), the new status takes effect immediately on the traffic incidents.
Declaration
Swift
var areTrafficIncidentsEnabled: Bool { get set }
Removes an observer from the list of tap observers.
The specified observer will no longer receive notifications of tap events on TrafficSection
.
Important
This is a Public Preview API. It may be changed or removed at any time.
Declaration
Swift
func removeTrafficIncidentTapObserver(_ observer: TrafficIncidentTapObserver)
Parameters
observer
|
An object that conforms to the |
Gets the list of TrafficIncident
s that are being displayed on a certain TomTomSDKRoute/Route
.
Declaration
Swift
func trafficIncidents(on route: TomTomSDKRoute.Route) -> [TrafficIncident]
Parameters
route
|
The |
Return Value
The list of TrafficIncident
s on the route, or nil
if the route is not in routes
.