Route

public struct Route : CustomStringConvertible

The route represents the result of the route planning including geometry and generated instructions.

Lifecycle

  • Creates an instance of Route.

    Throws

    InitializationError if parameters are invalid.

    Declaration

    Swift

    public init(
        id: UUID = UUID(),
        computedAs: ComputedAs = .primary,
        summary: Summary,
        legs: [RouteLeg],
        routeStops: [TomTomSDKRoute.RouteStop],
        sections: Sections,
        routePoints: [RoutePoint] = [],
        guidanceProgressOffset: Measurement<UnitLength> = .tt.centimeters(0),
        modificationHistory: RouteModificationHistory = RouteModificationHistory(),
        planningReason: PlanningReason = .requested
    ) throws

    Parameters

    id

    A unique identifier of the route in UUID format.

    computedAs

    Determines if the route was computed as primary or path alternative with regards to the given cost model.

    summary

    A collection of data fields representing the properties of the route.

    legs

    List of route legs.

    routeStops

    List containing every route stop along the route, including origin and destination.

    sections

    Information about sections of the route.

    routePoints

    Extended representation of the route.

    guidanceProgressOffset

    The offset where incremental computation of route contents was paused.

    modificationHistory

    Information about route creation and last route update.

    planningReason

    The reason why the route was planned.

Public

  • Determines if the route was computed as primary with regards to the given cost model, or if it is a path alternative, meaning a distinct path depending on the previous computed routes.

    See more

    Declaration

    Swift

    public enum ComputedAs

InitializationError

  • InitializationError used for indicating initialization errors.

    See more

    Declaration

    Swift

    public enum InitializationError : Error
  • id

    A unique identifier of the route in UUID format.

    Declaration

    Swift

    public let id: UUID
  • Defines how was the route initially computed. Whether as primary, or pathAlternative.

    Declaration

    Swift

    public let computedAs: ComputedAs
  • A collection of data fields representing the properties of the route.

    Declaration

    Swift

    public let summary: Summary
  • List of route legs.

    Declaration

    Swift

    public let legs: [RouteLeg]
  • List containing every route stop along the route, including origin and destination.

    Declaration

    Swift

    public let routeStops: [RouteStop]
  • Information about sections of the route.

    Declaration

    Swift

    public let sections: Sections
  • Extended representation of the route.

    Note

    Route points do not contain duplicates on leg intersections.

    Declaration

    Swift

    public let routePoints: [RoutePoint]
  • Information about route creation and last route update.

    Declaration

    Swift

    public var modificationHistory: RouteModificationHistory
  • The reason why the route was planned.

    Declaration

    Swift

    public let planningReason: PlanningReason
  • The offset where incremental computation of route contents was paused.

    Declaration

    Swift

    public let guidanceProgressOffset: Measurement<UnitLength>
  • List of coordinate pairs that describe the shape of this route. Note if the route has more than one RouteLeg, the coordinates at the leg intersections are not duplicated.

    Declaration

    Swift

    public var geometry: [CLLocationCoordinate2D] { get }
  • The description of the route.

    Declaration

    Swift

    public var description: String { get }
  • The list of waypoints.

    Declaration

    Swift

    public var waypoints: [RouteStop] { get }
  • The origin point of the route.

    Declaration

    Swift

    public var origin: RouteStop { get }
  • The destination point of the route.

    Declaration

    Swift

    public var destination: RouteStop { get }