VehicleProvider
public protocol VehicleProvider
Responsible for control, access and notification of the vehicle state.
Important
This is a Public Preview API. It may be changed or removed at any time.-
Snapshot of the current vehicle state. It is expected to be called from any queue.
Declaration
Swift
var vehicleSnapshot: Vehicle { get } -
Registers a vehicle update observer for all vehicle property updates. The call is expected on the main queue.
Throws
Throws:VehicleError.alreadyRegisteredObserverupon adding the same observer more than once.Declaration
Swift
func addObserver(_ observer: some VehicleUpdateObserver) throwsParameters
observerThe observer to be registered.
-
Registers a vehicle update observer for specific vehicle property updates. The call is expected on the main queue.
Throws
Throws:VehicleError.alreadyRegisteredObserverupon adding the same observer more than once.Declaration
Swift
func addObserver(_ observer: some VehicleUpdateObserver, for trackedPropertyIDs: [PropertyID]) throwsParameters
observerThe observer to be registered.
trackedPropertyIDsIdentifiers of vehicle properties whose changes will trigger the notification.
-
Removes a previously registered observer.
Important
Observer-related requests should be called on the main queue. Failure to do so may result in erratic behavior.
Declaration
Swift
func removeObserver(_ observer: some VehicleUpdateObserver)Parameters
observerThe registered observer.
VehicleProvider Protocol Reference