TrafficService
public protocol TrafficService : AnyObject
Important
This is a Public Preview API. It may be changed or removed at any time.-
Important
This is a Public Preview API. It may be changed or removed at any time. Cloud traffic provider connectivity status.true
if connection has been established,false
otherwise.Declaration
Swift
var isConnected: Bool { get }
-
Important
This is a Public Preview API. It may be changed or removed at any time. Number of traffic events currently known by the client.Declaration
Swift
var trafficEventCount: Int { get }
-
Important
This is a Public Preview API. It may be changed or removed at any time. Updates the traffic client’sLocale
.Note
Locale
is used to select the desired locale when receiving multi-lingual data or when extracting textual location details from the map.Declaration
Swift
func updateLocale(_ locale: Locale)
Parameters
locale
The new
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
func trafficEvents(for boundingBox: BoundingBox) async throws -> [TrafficEvent]
Parameters
boundingBox
The area to look for the
TrafficEvents
.Return Value
Array of
TrafficEvents
within the givenboundingBox
. -
Asynchronously calls a completion callback with a result containing
TrafficEvents
within the givenboundingBox
, or an error.Important
This is a Public Preview API. It may be changed or removed at any time.
Declaration
Swift
func getTrafficEvents( for boundingBox: BoundingBox, completion: @escaping (Result<[TrafficEvent], Error>) -> () )
Parameters
boundingBox
The area to look for the
TrafficEvents
.completion
The completion handler to call with the result. The handler may be 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 theonTrafficUpdated()
implementation of a registered observer may result in a deadlock.Declaration
Swift
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 theonTrafficUpdated()
implementation of a registered observer may result in a deadlock.Declaration
Swift
func removeObserver(_ observer: TrafficUpdateObserver)
Parameters
observer
An instance of
TrafficUpdateObserver
to remove.