Protocols

The following protocols are available globally.

  • Defines publishable and subscribable action. It should be deprecated. Since there is no policy for deprecation yet, it will be done here https://jira.tomtomgroup.com/browse/GOSDK-9928.

    Declaration

    Swift

    public protocol Event
  • 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

QueryItemConvertible

  • QueryItemConvertible allows Any become a URLQueryItem

    Example:

    “``extension String: QueryItemConvertible { public func queryItem(key: String) -> URLQueryItem? { .init(name: key, value: self) } }

    - Important: This is a Public Preview API. It may be changed or removed at any time.
    

    Declaration

    Swift

    public protocol QueryItemConvertible

QueryItemArrayConvertable

  • QueryItemConvertible allows Any become an array of URLQueryItems

    Example that allows an array of SectionTypes become an array of URLQueryItems

    extension SectionType: QueryItemConvertible {
        public func queryItem(key: String) -> URLQueryItem? {
            guard let value = value else { return nil }
            return .init(name: key, value: value)
        }
    }
    
    extension Array: QueryItemArrayConvertable where Element == SectionType {
        public func queryItems(key: String) -> [URLQueryItem]? {
            guard count > 0 else { return nil }
            return compactMap { $0.value }.map { URLQueryItem(name: key, value: $0) }
        }
    }
    
    ```
    - Important: This is a Public Preview API. It may be changed or removed at any time.`
    

    Declaration

    Swift

    public protocol QueryItemArrayConvertable

Observer

  • Any concrete observer should conform to this protocol so we can create a weak reference to it.

    Declaration

    Swift

    public protocol Observer : AnyObject

Motorized

  • 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.

    Important

    This is a Public Preview API. It may be changed or removed at any time.
    See more

    Declaration

    Swift

    public protocol Motorized

CargoCapable

  • Trait interface for vehicles that may have restrictions due to load.

    Important

    This is a Public Preview API. It may be changed or removed at any time.
    See more

    Declaration

    Swift

    public protocol CargoCapable

Vehicle

  • Specifies the vehicle (or lack of one).

    Important

    This is a Public Preview API. It may be changed or removed at any time.
    See more

    Declaration

    Swift

    public protocol Vehicle