Protocols
The following protocols are available globally.
-
Protocols that inherit this protocol are considered locked and can be conformed to and implemented only inside the TomTomSDK.
Important
This protocol should not be implemented by any other framework except TomTom components. The source and runtime stability aren’t guaranteed otherwise.Note
to test code that depends on APIs that conform toConformanceLocked, isolate these APIs with an additional abstraction (wrapper). Build your implementation with this abstraction as a dependency. Here is a way to do it by creating an additional protocol:// An example of protocol that provides necessary functionality in the TomTomSDK. public protocol Planner: ConformanceLocked { func plan() } // An abstraction from the client side that provides the same interface but is not locked. // Every TomTomSDK protocol might need this protocol clone. // Use this type to pass it in the application and in tests. protocol ClientPlanner { // The method should have the same signature func plan() } // Wrapper implementation on the client side that will contain TomTomSDK dependency // but conform to the non-locked protocol class ClientWrapperPlanner: ClientPlanner { let planner: Planner init(_ planner: Planner) { self.planner = planner } func plan() { planner.plan() } } // An example of the production code that needs to be tested. // Use `ClientPlanner` in your production code, so you can mock it. struct PlannerViewModel { init(_ planner: ClientPlanner) { } // // ... } // In production code let planner: Planner = ... // getting real planner PlannerViewModel(ClientWrapperPlanner(planner)) By depending on `ClientPlanner` a `PlannerViewModel` instance can be tested by mocking all its dependencies. To mock its dependencies, replace `ClientWrapperPlanner` with a mocked implementation of `ClientPlanner`.See moreImportant
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol ConformanceLocked -
Defines publishable and subscribable action.
Declaration
Swift
@available(*, deprecated, message: "This API is deprecated and will be removed with the next major release.") public protocol Event
-
Protocol that defines log destination, such as file, console, etc.
For more information on log configurator see
LogConfigurator.For more information on log configuration see
LogConfiguration.See moreImportant
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol LoggerOutput -
Identifier of the map.
Declaration
Swift
public protocol MapID -
Position of the map.
Note
Do not implement this protocol. Use the TomTomSDK concrete class that implements this protocol.Declaration
Swift
public protocol MapPosition -
A reference of a map ID and arc information.
Declaration
Swift
public protocol MapReferences -
Region ID for a region inside a map.
Declaration
Swift
public protocol RegionID
-
Any concrete observer should conform to this protocol so we can create a weak reference to it.
Declaration
Swift
public protocol Observer : AnyObject
-
Observableis an interface for a container of observers. It allows sending notifications on certain events to all of the registered observers.We provide the implementation of this protocol:
See moreTomTomSDKCommon/ObservableHandler.Declaration
Swift
public protocol Observable
-
Represents a cancellation handler over an asynchronous operation. Cancellation may be immediate or simply requested to happen sometime in the future.
A typical usage for
Cancellableis to return it from the asynchronous completion-based API.let cancellable = asynchronousFunction(completion: completion) if shouldCancel { cancellable.cancel() }See moreNote
Cancellableimplementation must support thread-safety and guarantee that after callingcancel()the cancellation happens only once.Declaration
Swift
public protocol Cancellable
-
Trait interface for vehicles that may have electric and/or combustion engines. These vehicles may also be subject to restrictions based on their size or weight.
Both engines should be set for a hybrid vehicle. Setting no engine is also fine if consumption is irrelevant for a calculation, such as when requesting a range based on time or distance budgets.
See moreImportant
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol Motorized
-
Trait interface for vehicles that may have restrictions due to load.
See moreImportant
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol CargoCapable
-
Specifies the vehicle (or lack of one).
Important
You cannot declare new conformances. OnlyTomTomSDKCommon/Pedestrian,TomTomSDKCommon/Bicycle,TomTomSDKCommon/Car,TomTomSDKCommon/Motorcycle,TomTomSDKCommon/Van,TomTomSDKCommon/Taxi,TomTomSDKCommon/BusandTomTomSDKCommon/Truckare valid conforming types.See moreImportant
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol Vehicle : ConformanceLocked
Protocols Reference