RouteProgress
open class RouteProgress : Codable
RouteProgress stores the user’s progress along a route.
-
Intializes a new
RouteProgress.Declaration
Swift
public init(route: Route, options: RouteOptions, legIndex: Int = 0, spokenInstructionIndex: Int = 0, routeShapeIndex: Int = 0, legShapeIndex: Int = 0)Parameters
routeThe route to follow.
optionsThe route options that were attached to the route request.
legIndexZero-based index indicating the current leg the user is on.
routeShapeIndexIndex relative to route shape, representing the point the user is currently located at.
legShapeIndexIndex relative to leg shape, representing the point the user is currently located at.
-
Current
RouteOptions, optimized for rerouting.This method is useful for implementing custom rerouting. Resulting
RouteOptionsskip passed waypoints and include current user heading if possible.Declaration
Swift
public func reroutingOptions(from location: CLLocation) -> RouteOptionsParameters
locationCurrent user location. Treated as route origin for rerouting.
Return Value
Modified
RouteOptions.
-
Returns the current
RouteOptions.Declaration
Swift
public let routeOptions: RouteOptions -
Total distance traveled by user along all legs.
Declaration
Swift
public var distanceTraveled: CLLocationDistance { get } -
Total seconds remaining on all legs.
Declaration
Swift
public var durationRemaining: TimeInterval { get } -
Number between 0 and 1 representing how far along the
Routethe user has traveled.Declaration
Swift
public var fractionTraveled: Double { get } -
Total distance remaining in meters along route.
Declaration
Swift
public var distanceRemaining: CLLocationDistance { get } -
The waypoints remaining on the current route.
This property does not include waypoints whose
Waypoint.separatesLegsproperty is set tofalse.Declaration
Swift
public var remainingWaypoints: [Waypoint] { get } -
Upcoming
RouteAlertsas reported by the navigation engine.The contents of the array depend on user’s current progress along the route and are modified on each location update. This array contains only the alerts that the user has not passed. Some events may have non-zero length and are also included while the user is traversing it. You can use this property to get information about incoming points of interest.
Declaration
Swift
public internal(set) var upcomingRouteAlerts: [RouteAlert] { get } -
Returns an array of
CLLocationCoordinate2Dof the coordinates along the current step and any adjacent steps.Important
The adjacent steps may be part of legs other than the current leg.Declaration
Swift
public var nearbyShape: LineString { get }
-
Updates the current route with attributes from the given skeletal route.
Declaration
Swift
public func refreshRoute(with refreshedRoute: RouteRefreshSource, at location: CLLocation) -
Declaration
Swift
public func refreshRoute(with refreshedRoute: RouteRefreshSource, at location: CLLocation, legIndex: Int, legShapeIndex: Int) -
Index relative to route shape, representing the point the user is currently located at.
Declaration
Swift
public internal(set) var shapeIndex: Int { get } -
Increments the progress according to new location specified.
Declaration
Swift
public func updateDistanceTraveled(with location: CLLocation)Parameters
locationUpdated user location.
-
Index representing current
RouteLeg.Declaration
Swift
public var legIndex: Int { get set } -
Returns the remaining legs left on the current route
Declaration
Swift
public var remainingLegs: [RouteLeg] { get } -
Returns true if
currentLegis the last leg.Declaration
Swift
public var isFinalLeg: Bool { get } -
Returns the progress along the current
RouteLeg.Declaration
Swift
public var currentLegProgress: RouteLegProgress -
Declaration
Swift
public var priorLeg: RouteLeg? { get } -
The leg following the current leg along this route.
If this leg is the last leg of the route, this property is set to nil.
Declaration
Swift
public var upcomingLeg: RouteLeg? { get }
-
Returns the remaining steps left on the current route
Declaration
Swift
public var remainingSteps: [RouteStep] { get } -
The step prior to the current step along this route.
The prior step may be part of a different RouteLeg than the current step. If the current step is the first step along the route, this property is set to nil.
Declaration
Swift
public var priorStep: RouteStep? { get } -
The step following the current step along this route.
The upcoming step may be part of a different RouteLeg than the current step. If it is the last step along the route, this property is set to nil.
Declaration
Swift
public var upcomingStep: RouteStep? { get }
-
Tuple containing a
CongestionLeveland a correspondingTimeIntervalrepresenting the expected travel time for this segment.Declaration
Swift
public typealias TimedCongestionLevel = (CongestionLevel, TimeInterval) -
If the route contains both
segmentCongestionLevelsandexpectedSegmentTravelTimes, this property is set to a deeply nested array ofTimeCongestionLevelsper segment per step per leg.Declaration
Swift
public private(set) var congestionTravelTimesSegmentsByStep: [[[TimedCongestionLevel]]] { get } -
An dictionary containing a
TimeIntervaltotal perCongestionLevel. OnlyCongestionLevelfounnd on that step will present. Broken up by leg and then step.Declaration
Swift
public private(set) var congestionTimesPerStep: [[[CongestionLevel : TimeInterval]]] { get } -
Declaration
Swift
public var averageCongestionLevelRemainingOnLeg: CongestionLevel? { get }
-
Declaration
Swift
required public init(from decoder: Decoder) throws -
Declaration
Swift
public func encode(to encoder: Encoder) throws
Install in Dash
RouteProgress Class Reference