RouteProgress
@objc(MBRouteProgress)
open class RouteProgress : NSObject
RouteProgress
stores the user’s progress along a route.
-
Returns the current
Route
.Declaration
Swift
@objc public let route: Route
-
Index representing current
RouteLeg
.Declaration
Swift
@objc public var legIndex: Int { get set }
-
If waypoints are provided in the
Route
, this will contain which leg the user is on.Declaration
Swift
@objc public var currentLeg: RouteLeg { get }
-
Returns the remaining legs left on the current route
Declaration
Swift
@objc public var remainingLegs: [RouteLeg] { get }
-
Returns the remaining steps left on the current route
Declaration
Swift
@objc public var remainingSteps: [RouteStep] { get }
-
Returns true if
currentLeg
is the last leg.Declaration
Swift
public var isFinalLeg: Bool { get }
-
Total distance traveled by user along all legs.
Declaration
Swift
@objc public var distanceTraveled: CLLocationDistance { get }
-
Total seconds remaining on all legs.
Declaration
Swift
@objc public var durationRemaining: TimeInterval { get }
-
Number between 0 and 1 representing how far along the
Route
the user has traveled.Declaration
Swift
@objc public var fractionTraveled: Double { get }
-
Total distance remaining in meters along route.
Declaration
Swift
@objc public var distanceRemaining: CLLocationDistance { get }
-
Number of waypoints remaining on the current route.
Declaration
Swift
@objc public var remainingWaypoints: [Waypoint] { get }
-
Returns the progress along the current
RouteLeg
.Declaration
Swift
@objc public var currentLegProgress: RouteLegProgress
-
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
@objc public var priorStep: RouteStep? { 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
@objc public var upcomingLeg: RouteLeg? { 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 }
-
Returns an array of
CLLocationCoordinate2D
of 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
@objc public var nearbyCoordinates: [CLLocationCoordinate2D] { get }
-
Tuple containing a
CongestionLevel
and a correspondingTimeInterval
representing the expected travel time for this segment.Declaration
Swift
public typealias TimedCongestionLevel = (CongestionLevel, TimeInterval)
-
If the route contains both
segmentCongestionLevels
andexpectedSegmentTravelTimes
, this property is set to a deeply nested array ofTimeCongestionLevels
per segment per step per leg.Declaration
Swift
public var congestionTravelTimesSegmentsByStep: [[[RouteProgress.TimedCongestionLevel]]]
-
An dictionary containing a
TimeInterval
total perCongestionLevel
. OnlyCongestionLevel
founnd on that step will present. Broken up by leg and then step.Declaration
Swift
public var congestionTimesPerStep: [[[CongestionLevel : TimeInterval]]]
-
Intializes a new
RouteProgress
.Declaration
Swift
@objc public init(route: Route, legIndex: Int = 0, spokenInstructionIndex: Int = 0)
Parameters
route
The route to follow.
legIndex
Zero-based index indicating the current leg the user is on.