TomTomSDKCommon

  • A class for restricting protocol conformance to TomTomSDK components.

    Important

    This class should not be instantiated by any other framework except TomTom components. The API and runtime stability aren’t guaranteed otherwise.

    Declaration

    Swift

    public final class ConformanceLock<T>
  • 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 to ConformanceLocked, 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 more

    Declaration

    Swift

    public protocol ConformanceLocked
  • Describes the type of electric current

    See more

    Declaration

    Swift

    public enum CurrentType
  • A charging point corresponds to an EVSE (Electric Vehicle Supply Equipment). This can be thought of as the charging facility capable of accomodating one car.

    Important

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

    Declaration

    Swift

    public struct ChargingPoint
    extension ChargingPoint: Equatable
    extension ChargingPoint: Hashable
  • A charging station has several charging points, of which only several points can be used at the same time.

    Important

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

    Declaration

    Swift

    public struct ChargingStation : Hashable
  • Specifies the minimum (inclusive) and maximum (exclusive) voltage values. The lower bound value should be a non-negative number (positive or zero). The upper bound value should be greater than the lower bound, or if set to zero, it will be treated as infinity. If not specified, a range of [0, infinity] is assumed.

    See more

    Declaration

    Swift

    public struct VoltageRange : Equatable, Hashable
  • 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
  • Units system

    See more

    Declaration

    Swift

    public enum UnitsSystem : CaseIterable, Equatable
  • Generic container for GeoJSON geometry types.

    GeoJSON is a geospatial data interchange format based on JavaScript Object Notation (JSON). It defines several types of JSON objects and the manner in which they are combined to represent data about geographic features, their properties, and their spatial extents. For more info on the GeoJSON format see the following document.

    See more

    Declaration

    Swift

    public struct GeoJSON<T>
    extension GeoJSON: Equatable where T: Equatable
  • The Feature structure encapsulates a GeoJSON Feature - a geospatial object with associated properties. GeoJSON supports the following geometry types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection. Features in GeoJSON contain a Geometry object and additional properties.

    See more

    Declaration

    Swift

    public struct Feature
    extension Feature: Equatable
  • GeoJSONGeometry is an enumeration representing the seven geometry types defined in the GeoJSON format. Each case of the enum wraps a corresponding structure that provides detailed geometric data.

    See more

    Declaration

    Swift

    public enum GeoJSONGeometry
    extension GeoJSONGeometry: Equatable
  • Fundamental geometry construct. All other GeoJSON geometry types are built based on it.

    See more

    Declaration

    Swift

    public struct GeoJSONPosition
    extension GeoJSONPosition: Equatable
  • The smallest rectangular area within which all the coordinates lie.

    See more

    Declaration

    Swift

    public struct BoundingBox : Equatable, Hashable
  • The Geometry struct represents a single geometric entity according to the GeoJSON specification.

    See more

    Declaration

    Swift

    public struct Geometry
    extension Geometry: Equatable
  • The GeometryCollection struct represents a collection of Geometry objects as defined by the GeoJSON specification. It provides a way to group multiple geometries together, regardless of their types.

    See more

    Declaration

    Swift

    public struct GeometryCollection
    extension GeometryCollection: Equatable
  • GeoJSON represented by GeometryData.

    See more

    Declaration

    Swift

    public struct GeometryData
  • Identifies a hazard.

    Important

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

    Declaration

    Swift

    public typealias HazardID = UUID
  • A hazard.

    Important

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

    Declaration

    Swift

    public struct Hazard : Equatable, Hashable
  • A collection of information that describes geographical location

    See more

    Declaration

    Swift

    public struct Address : Equatable
  • Information on how much to charge at a charging station.

    See more

    Declaration

    Swift

    public struct ChargingInformation
  • Defines fuel types supported in the fuzzy search.

    See more

    Declaration

    Swift

    public struct FuelType : Hashable
    extension FuelType: CustomDebugStringConvertible
  • Defines the OpeningHours of a POI.

    See more

    Declaration

    Swift

    public struct OpeningHours : Hashable
  • An option that defines for what days opening hours would be requested.

    See more

    Declaration

    Swift

    public enum OpeningHoursMode
    extension OpeningHoursMode: Equatable
    extension OpeningHoursMode: Hashable
  • POI

    Point of Interest information for a search result.

    See more

    Declaration

    Swift

    public struct POI : Hashable
  • Defines the source of the produced search result.

    Note

    this information might be helful when different Search instances are used and there is a need to distinguish results based on their origin.
    See more

    Declaration

    Swift

    public enum Source
  • Defines the POI identifier (POIID) required to fetch POI details.

    See more

    Declaration

    Swift

    public struct POIID : Hashable
  • Contains information about an EV charging park.

    Important

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

    Declaration

    Swift

    public struct ChargingPark : Hashable
  • Defines a POI brand.

    See more

    Declaration

    Swift

    public struct Brand : Hashable
  • POI category ID.

    See more

    Declaration

    Swift

    public struct POICategoryID : Hashable
  • Defines standard the POI category identifiers. The enum value provides the semantic of the POI category. Multiple POICategoryID can have the same StandardCategoryID value.

    See more

    Declaration

    Swift

    public enum StandardCategoryID : Int
  • A representation of an entry point for a POI.

    Important

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

    Declaration

    Swift

    public struct EntryPoint
    extension EntryPoint: Equatable
  • Represents information about specific place.

    See more

    Declaration

    Swift

    public struct Place : Equatable
  • 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.

    Important

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

    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
  • Extending standard structures like Measurement with properties like var meters is convenient:

    • it avoids extracting value without explicit conversion to a certain unit
    • it simplifies getting value from an optional Measurement

    But it is also risky because these extensions might conflict with extensions from other libraries or Apple. This decorator mitigates the risk of conflicts while providing a short, readable code.

    Typical use cases are:

    • extracting value from a value representing a unit of measure: let optionalDistanceInMeters = distance?.tt.meters
    • performing computations on values representing units of measure: cumulativeDistance += anotherDistance.tt
    • comparing values representing units of measure: if delay < .tt.seconds(5) {}
    • combining value extraction and typecast: let intValue = distance.tt.intValue(in: .meters)
    See more

    Declaration

    Swift

    public struct MeasurementDecorator<UnitType> where UnitType : Unit
  • Unit specifying the electric efficiency, e.g., in kilowatt hours per kilometer.

    See more

    Declaration

    Swift

    public final class TTUnitElectricEfficiency : Dimension
  • Unit specifying the energy density (of fuel). For example, energy density is 34.2 MJ/l for gasoline and 35.8 MJ/l for diesel fuel.

    See more

    Declaration

    Swift

    public final class TTUnitEnergyDensity : Dimension
  • Unit specifying the fuel usage (of a vehicle) over time.

    See more

    Declaration

    Swift

    public final class TTUnitFuelPerTime : Dimension
  • A quantity describing a ratio, also commonly used for probabilities. (For example, 10%.)

    See more

    Declaration

    Swift

    public final class TTUnitRatio : Dimension
  • MetadataProvider stores during app lifecycle additional metadata for HTTP requests to TomTom Network APIs and implements adding this additional metadata to HTTP request’s headers

    Important

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

    Declaration

    Swift

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

    Declaration

    Swift

    public protocol Observer : AnyObject
  • Observable is an interface for a container of observers. It allows sending notifications on certain events to all of the added observers.

    We provide the implementation of this protocol: TomTomSDKCommon/ObservableHandler.

    See more

    Declaration

    Swift

    public protocol Observable
  • A thread-safe implementation of the Observable container.

    Any method can be called from any queue. The notification of observers, completions, and other closures will be executed on a dispatch queue provided in the init method.

    Note

    If you rely on the onLastObserverRemoved closure, call removeObserver(:) explicitly. If the observer is destroyed without an explicit call to removeObserver(:), the onLastObserverRemoved call will be delayed until the next notify event when we detect that the last observer is nil and remove it.
    See more

    Declaration

    Swift

    public final class ObservableHandler : Observable
  • Indicates the driving side on the road.

    See more

    Declaration

    Swift

    public enum DrivingSide
  • Total number of lanes on the road in both directions.

    See more

    Declaration

    Swift

    public struct NumberOfLanes : Equatable
  • A coarse-grained classification of roads according to road purpose and capacity. In general, it is associated with specific horizon data.

    See more

    Declaration

    Swift

    public enum RoadCategory
  • Indicates the class of a road.

    Important

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

    Declaration

    Swift

    public enum RoadClass
  • Provides information about the properties of the road at the current location.

    See more

    Declaration

    Swift

    public struct RoadProperties : Equatable
  • Represents a road shield, a sign used to indicate the route number and the road’s classification.

    See more

    Declaration

    Swift

    public struct RoadShield : Equatable
  • Indicates the subclass of a road.

    Important

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

    Declaration

    Swift

    public enum RoadSubClass
  • Classifies roads according to their purpose and function. The road-type classification can be used for efficient traffic flow management, avoidance of specific routes based on selected criteria, and visual differentiation of road segments on the map.

    See more

    Declaration

    Swift

    public enum RoadType
  • Speed limit consisting of a speed limit type and a speed limit value.

    See more

    Declaration

    Swift

    public enum SpeedLimit : Equatable
  • Identifies a safety location.

    Declaration

    Swift

    public typealias SafetyLocationID = Int
  • Define a common safety location.

    See more

    Declaration

    Swift

    public struct SafetyLocation
    extension SafetyLocation: Equatable
    extension SafetyLocation: Hashable
  • Indicates the category to which a traffic event belongs.

    Important

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

    Declaration

    Swift

    public enum Category
  • Indicates the cause of a traffic event.

    Important

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

    Declaration

    Swift

    public struct Cause
  • Indicates the cause of the traffic event. Codes are chosen according to the TPEG-TEC standard.

    Important

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

    Declaration

    Swift

    public enum CauseCode
  • Important

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

    Declaration

    Swift

    public enum EffectCode
  • Representation of a traffic event. Traffic events represent unusual situations on the road, like traffic congestion, accidents or road works.

    Important

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

    Declaration

    Swift

    public struct TrafficEvent
  • Indicates the severity of the traffic event. Values are chosen according to the TPEG-TEC standard.

    Important

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

    Declaration

    Swift

    public enum WarningLevel
  • 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 Cancellable is to return it from the asynchronous completion-based API.

    let cancellable = asynchronousFunction(completion: completion)
    if shouldCancel {
       cancellable.cancel()
    }
    

    Note

    Cancellable implementation must support thread-safety and guarantee that after calling cancel() the cancellation happens only once.
    See more

    Declaration

    Swift

    public protocol Cancellable
  • Wrapper to provide equatable conformance to Apple objects inside of the SDK.

    See more

    Declaration

    Swift

    @propertyWrapper
    public struct EquatableWrapper<T> : Equatable
  • Specifies if the vehicle should be subjected to ADR tunnel restrictions.

    See more

    Declaration

    Swift

    public enum ADRTunnelRestrictionCode
  • Specifies the ratio by which energy is converted for altitude changes.

    See more

    Declaration

    Swift

    public struct AltitudeChangeEfficiency : Equatable, Hashable
  • Specifies the energy that is gained or lost by altitude changes.

    See more

    Declaration

    Swift

    public struct AltitudeChangeEnergy : Equatable, Hashable
  • A electric vehicle engine for route planning and consumption estimation.

    See more

    Declaration

    Swift

    public struct ElectricEngine
  • Represents the types of the vehicle engine (e.g., electric).

    See more

    Declaration

    Swift

    public enum EngineType
  • 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 more

    Declaration

    Swift

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

    See more

    Declaration

    Swift

    public protocol CargoCapable
  • Specifies the vehicle (or lack of one).

    Important

    You cannot declare new conformances. Only TomTomSDKCommon/Pedestrian, TomTomSDKCommon/Bicycle, TomTomSDKCommon/Car, TomTomSDKCommon/Motorcycle, TomTomSDKCommon/Van, TomTomSDKCommon/Taxi, TomTomSDKCommon/Bus and TomTomSDKCommon/Truck are valid conforming types.
    See more

    Declaration

    Swift

    public protocol Vehicle : ConformanceLocked
  • A pedestrian.

    Note

    This option is not yet supported with the Orbis map.
    See more

    Declaration

    Swift

    public struct Pedestrian : Vehicle, InternalConformanceLocked
  • A vehicle of type bicycle.

    Note

    This option is not yet supported with the Orbis map.
    See more

    Declaration

    Swift

    public struct Bicycle : Vehicle, InternalConformanceLocked
  • A vehicle of type motorcycle.

    Note

    This option is not yet supported with the Orbis map.
    See more

    Declaration

    Swift

    public struct Motorcycle : Vehicle, Motorized, InternalConformanceLocked
  • A vehicle of type taxi.

    Note

    This option is not yet supported with the Orbis map.
    See more

    Declaration

    Swift

    public struct Taxi : Vehicle, Motorized, InternalConformanceLocked
  • Bus

    A vehicle of type bus.

    Note

    This option is not yet supported with the Orbis map.
    See more

    Declaration

    Swift

    public struct Bus : Vehicle, Motorized, InternalConformanceLocked
  • Describes dimensions of the vehicle.

    See more

    Declaration

    Swift

    public struct VehicleDimensions
  • VehicleError used for exceptions indicating vehicle errors.

    See more

    Declaration

    Swift

    public enum VehicleError : Error, Equatable
  • Describes vehicle model identifier.

    See more

    Declaration

    Swift

    public struct VehicleModelID : Equatable
  • Represents the “vehicle type” parameter in a request to the Routing API.

    See more

    Declaration

    Swift

    public enum VehicleType
  • Specifies the ratio by which energy is converted during velocity changes.

    See more

    Declaration

    Swift

    public struct VelocityChangeEfficiency : Equatable, Hashable