Route

public final class Route : CustomStringConvertible

The Route class provides information about the navigation route.

Important

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

Lifecycle

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. Important: This is a Public Preview API. It may be changed or removed at any time.

    See more

    Declaration

    Swift

    public enum ComputedAs
  • 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
  • Summary of the route.

    Declaration

    Swift

    public let summary: Summary
  • List of route legs.

    Declaration

    Swift

    public let legs: [RouteLeg]
  • List of the route stops.

    Declaration

    Swift

    public var routeStops: [RouteStop]
  • Route sections

    Declaration

    Swift

    public let sections: Sections
  • List of the route points.

    Declaration

    Swift

    public var routePoints: [RoutePoint]
  • List of all coordinates of the route.

    Declaration

    Swift

    public lazy var geometry: [CLLocationCoordinate2D] { get set }
  • The start coordinate of the route.

    Declaration

    Swift

    public let start: CLLocationCoordinate2D
  • end

    The end coordinate of the route.

    Declaration

    Swift

    public let end: CLLocationCoordinate2D
  • Route modification history

    Declaration

    Swift

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

    Declaration

    Swift

    public var planningReason: PlanningReason
  • List of segment distances. Items on the list represent the cumulative offset (in meters) from the start coordinate of the route.

    Declaration

    Swift

    public lazy var segmentDistances: [Double] { get set }
  • The offset where incremental computation of route contents was paused.

    Declaration

    Swift

    public var guidanceProgressOffset: Measurement<UnitLength>
  • The description of the route.

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    public var destination: Destination? { get }
  • Calculates the index of the segment that includes a point on the route in the given distance along the route.

    Declaration

    Swift

    public func getLineSegmentNr(preIndex: Int, distanceAlongRoute: Double) -> Int

    Parameters

    preIndex

    The lowest index of the segment to start the calculation.

    distanceAlongRoute

    The distance along the route

    Return Value

    The index of the segment that includes a point on the route in the given distance. If the index can’t be calculated, a negative value is returned.

  • Returns a 2D array (broken into legs) of route points still to be driven.

    Important

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

    Declaration

    Swift

    public func remainingRoutePoints(distanceAlongRoute: Measurement<UnitLength>) -> [[RoutePoint]]

    Parameters

    distanceAlongRoute

    Distance already traveled along the route in meters

Route

  • Copies the current route with changes specified in build closure

    Declaration

    Swift

    public func copy(build: (inout Builder) -> ()) -> Route?

    Parameters

    build

    This closure allows for change of Route values

    Return Value

    A route with the changes set on the closure

  • The Builder creates a new instance of Route with modified fields.

    See more

    Declaration

    Swift

    public struct Builder