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 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:
See more// 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`.
Declaration
Swift
public protocol ConformanceLocked
-
Information about one of the connectors available in the
See moreChargingPark
.Declaration
Swift
public struct ConnectorDetails : Hashable
-
The connector type.
This list is based on the supported connector types by online search, documented at the following link: https://developer.tomtom.com/search-api/documentation/product-information/supported-connector-types
See moreDeclaration
Swift
public enum ConnectorType
-
Describes the type of electric current
See moreDeclaration
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.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.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 moreDeclaration
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 moreDeclaration
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 moreDeclaration
Swift
public struct GeoJSON<T>
extension GeoJSON: Equatable where T: Equatable
-
A single GeoJSON position.
Declaration
Swift
public typealias PointGeometry = GeoJSON<GeoJSONPosition>
-
An array of GeoJSON positions.
Declaration
Swift
public typealias MultiPointGeometry = GeoJSON<[GeoJSONPosition]>
-
An array of two or more GeoJSON positions.
Declaration
Swift
public typealias LineStringGeometry = GeoJSON<[GeoJSONPosition]>
-
An array of line string geometries. Each line string is represented by a one-dimensional GeoJSON position array.
Declaration
Swift
public typealias MultiLineStringGeometry = GeoJSON<[[GeoJSONPosition]]>
-
An array of linear ring geometries. Each linear ring is represented by a one-dimensional GeoJSON position array. For polygons with multiple rings, the first must be the exterior ring and any others must be interior rings or holes.
Declaration
Swift
public typealias PolygonGeometry = GeoJSON<[[GeoJSONPosition]]>
-
An array of polygon geometries.
Declaration
Swift
public typealias MultiPolygonGeometry = GeoJSON<[[[GeoJSONPosition]]]>
-
The
See moreFeature
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 aGeometry
object and additional properties.Declaration
Swift
public struct Feature
extension Feature: Equatable
-
See moreGeoJSONGeometry
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.Declaration
Swift
public enum GeoJSONGeometry
extension GeoJSONGeometry: Equatable
-
Fundamental geometry construct. All other GeoJSON geometry types are built based on it.
See moreDeclaration
Swift
public struct GeoJSONPosition
extension GeoJSONPosition: Equatable
-
Declaration
Swift
extension EncodableFeatureCollection: Encodable
-
Declaration
Swift
extension StringFromDataInitializationError: LocalizedError
-
The smallest rectangular area within which all the coordinates lie.
See moreDeclaration
Swift
public struct BoundingBox : Equatable, Hashable
-
The
See moreGeometry
struct represents a single geometric entity according to the GeoJSON specification.Declaration
Swift
public struct Geometry
extension Geometry: Equatable
-
The
See moreGeometryCollection
struct represents a collection ofGeometry
objects as defined by the GeoJSON specification. It provides a way to group multiple geometries together, regardless of their types.Declaration
Swift
public struct GeometryCollection
extension GeometryCollection: Equatable
-
GeoJSON represented by
See moreGeometryData
.Declaration
Swift
public struct GeometryData
-
Describes the detailed Hazard information.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public class DetailedHazardInformation : Equatable, Hashable
-
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.Declaration
Swift
public struct Hazard : Equatable, Hashable
-
Categories of hazards.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public enum HazardCategory
-
The location information for the hazard.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public enum HazardLocation
extension HazardLocation: Equatable, Hashable
-
The severity of a hazard describes its criticality with respect to the danger. The severity may get lower over time as the hazardous situation becomes more secure (e.g., police regulating traffic).
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public enum HazardSeverity
-
Describes the type of Hazard data.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public enum HazardType : Equatable, Hashable
extension HazardType: CaseIterable
-
Defines fuel types supported in the fuzzy search.
See moreDeclaration
Swift
public struct FuelType : Hashable
extension FuelType: CustomDebugStringConvertible
-
Defines the OpeningHours of a POI.
See moreDeclaration
Swift
public struct OpeningHours : Hashable
-
An option that defines for what days opening hours would be requested.
See moreDeclaration
Swift
public enum OpeningHoursMode
extension OpeningHoursMode: Equatable
extension OpeningHoursMode: Hashable
-
Point of Interest information for a search result.
See moreDeclaration
Swift
public struct POI : Hashable
-
Defines the POI identifier (POIID) required to fetch POI details.
See moreDeclaration
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.Declaration
Swift
public struct ChargingPark : Hashable
-
POI category ID.
See moreDeclaration
Swift
public struct POICategoryID : Hashable
-
Defines standard the POI category identifiers. The enum value provides the semantic of the POI category. Multiple
See morePOICategoryID
can have the sameStandardCategoryID
value.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.Declaration
Swift
public struct EntryPoint
extension EntryPoint: Equatable
-
Represents information about specific place.
See moreDeclaration
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.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 likevar 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)
Declaration
Swift
public struct MeasurementDecorator<UnitType> where UnitType : Unit
-
Unit specifying the electric efficiency, e.g., in kilowatt hours per kilometer.
See moreDeclaration
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 moreDeclaration
Swift
public final class TTUnitEnergyDensity : Dimension
-
Unit specifying the fuel usage (of a vehicle) over time.
See moreDeclaration
Swift
public final class TTUnitFuelPerTime : Dimension
-
A quantity describing a ratio, also commonly used for probabilities. (For example, 10%.)
See moreDeclaration
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 headersImportant
This is a Public Preview API. It may be changed or removed at any time.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:
See moreTomTomSDKCommon/ObservableHandler
.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, callremoveObserver(:)
explicitly. If the observer is destroyed without an explicit call toremoveObserver(:)
, theonLastObserverRemoved
call will be delayed until the next notify event when we detect that the last observer isnil
and remove it.Declaration
Swift
public final class ObservableHandler : Observable
-
Indicates the driving side on the road.
See moreDeclaration
Swift
public enum DrivingSide
-
Total number of lanes on the road in both directions.
See moreDeclaration
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 moreDeclaration
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.Declaration
Swift
public enum RoadClass
-
Road pavement condition types.
See moreDeclaration
Swift
public enum RoadCondition
-
Provides information about the properties of the road at the current location.
See moreDeclaration
Swift
public struct RoadProperties : Equatable
-
Represents a road shield, a sign used to indicate the route number and the road’s classification.
See moreDeclaration
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.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 moreDeclaration
Swift
public enum RoadType
-
Speed limit consisting of a speed limit type and a speed limit value.
See moreDeclaration
Swift
public enum SpeedLimit : Equatable
-
Identifies a safety location.
Declaration
Swift
public typealias SafetyLocationID = Int
-
Define a common safety location.
See moreDeclaration
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.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.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.Declaration
Swift
public enum CauseCode
-
Indicates the effect the traffic event has on the traffic flow. 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.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.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.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 callingcancel()
the cancellation happens only once.Declaration
Swift
public protocol Cancellable
-
Wrapper to provide equatable conformance to Apple objects inside of the SDK.
See moreDeclaration
Swift
@propertyWrapper public struct EquatableWrapper<T> : Equatable
-
Specifies if the vehicle should be subjected to ADR tunnel restrictions.
See moreDeclaration
Swift
public enum ADRTunnelRestrictionCode
-
Specifies the ratio by which energy is converted for altitude changes.
See moreDeclaration
Swift
public struct AltitudeChangeEfficiency : Equatable, Hashable
-
Specifies the energy that is gained or lost by altitude changes.
See moreDeclaration
Swift
public struct AltitudeChangeEnergy : Equatable, Hashable
-
Describes connector information of an electric engine.
See moreDeclaration
Swift
public struct ChargingConnector : Equatable, Hashable
-
Specifies the efficiency of the vehicle. Refer to the original type
CombustionEngine.Efficiency
for more information.Declaration
Swift
public typealias CombustionVehicleEfficiency = CombustionEngine.Efficiency
-
Describes parameters used to determine the vehicle power and consumption. Refer to the original type
CombustionEngine.Consumption
for more information.Declaration
Swift
public typealias CombustionVehicleConsumption = CombustionEngine.Consumption
-
A combustion vehicle engine for route planning and consumption estimation.
See moreDeclaration
Swift
public struct CombustionEngine
-
Specifies the efficiency of the vehicle. Refer to the original type
ElectricEngine.Efficiency
for more information.Declaration
Swift
public typealias ElectricVehicleEfficiency = ElectricEngine.Efficiency
-
Describes capacity and the consumption of the EV. Refer to the original type
ElectricEngine.Consumption
for more information.Declaration
Swift
public typealias ElectricVehicleConsumption = ElectricEngine.Consumption
-
Describes capacity and current charge of the EV. Refer to the original type
ElectricEngine.ChargeLevel
for more information.Declaration
Swift
public typealias ChargeLevel = ElectricEngine.ChargeLevel
-
Describes connector information of an electric engine. Refer to the original type
ElectricEngine.ChargingParameters
for more information.Declaration
Swift
public typealias ChargingParameters = ElectricEngine.ChargingParameters
-
A electric vehicle engine for route planning and consumption estimation.
See moreDeclaration
Swift
public struct ElectricEngine
-
Represents the types of the vehicle engine (e.g., electric).
See moreDeclaration
Swift
public enum EngineType
-
Represents types of cargo that may be classified as hazardous materials and restricted from some roads. Available values are UN Hazmat classes 1 through 9, plus generic classifications for use in other countries. For more information about the Hazmat classes, refer to: https://www.iafc.org/topics-and-tools/hazmat/fusion-center/transportation-commodities/dot-hazard-classification-system
See moreDeclaration
Swift
public enum HazmatClass
-
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 moreDeclaration
Swift
public protocol Motorized
-
Trait interface for vehicles that may have restrictions due to load.
See moreDeclaration
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/Bus
andTomTomSDKCommon/Truck
are valid conforming types.Declaration
Swift
public protocol Vehicle : ConformanceLocked
-
Declaration
Swift
public struct Van : Vehicle, Motorized, CargoCapable, InternalConformanceLocked
-
Declaration
Swift
public struct Truck : Vehicle, Motorized, CargoCapable, InternalConformanceLocked
-
Describes vehicle model identifier.
See moreDeclaration
Swift
public struct VehicleModelID : Equatable
-
Represents the “vehicle type” parameter in a request to the Routing API.
See moreDeclaration
Swift
public enum VehicleType
-
Specifies the ratio by which energy is converted during velocity changes.
See moreDeclaration
Swift
public struct VelocityChangeEfficiency : Equatable, Hashable
-
Declaration
Swift
extension Locale
-
Declaration
Swift
extension Measurement
extension Measurement where UnitType: Dimension
-
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
extension Array where Element == CLLocationCoordinate2D
extension Array where Element == RoutePoint