RouteResponse
public struct RouteResponse : ForeignMemberContainer
extension RouteResponse: Codable
A RouteResponse object is a structure that corresponds to a directions response returned by the Mapbox Directions API.
-
Declaration
Swift
public var foreignMembers: JSONObject -
The raw HTTP response from the Directions API.
Declaration
Swift
public let httpResponse: HTTPURLResponse? -
The unique identifier that the Mapbox Directions API has assigned to this response.
Declaration
Swift
public let identifier: String? -
An array of
Waypointobjects in the order of the input coordinates. EachWaypointis an input coordinate snapped to the road and path network.This property omits the waypoint corresponding to any waypoint in
RouteOptions.waypointsthat hasWaypoint.separatesLegsset totrue.Declaration
Swift
public let waypoints: [Waypoint]? -
The criteria for the directions response.
Declaration
Swift
public let options: ResponseOptions -
The credentials used to make the request.
Declaration
Swift
public let credentials: Credentials -
The time when this
RouteResponseobject was created, which is immediately upon recieving the raw URL response.If you manually start fetching a task returned by
Directions.url(forCalculating:), this property is set tonil; use theURLSessionTaskTransactionMetrics.responseEndDateproperty instead. This property may also be set tonilif you create this result from a JSON object or encoded object.This property does not persist after encoding and decoding.
Declaration
Swift
public var created: Date -
Managed array of
RoadClassesrestrictions specified toRouteOptions.roadClassesToAvoidwhich were violated during route calculation.Routing engine may still utilize
RoadClassesmeant to be avoided in cases when routing is impossible otherwise.Violations are ordered by routes from the
routesarray, then by a leg, step, and intersection, whereRoadClassesrestrictions were ignored.niland empty return arrays correspond toniland emptyroutesarray respectively.Declaration
Swift
public private(set) var roadClassExclusionViolations: [RoadClassExclusionViolation]? { get } -
Declaration
Swift
public init(from decoder: Decoder) throws -
Declaration
Swift
public func encode(to encoder: Encoder) throws -
Filters
roadClassExclusionViolationslazily to search for specific leg and step.Passing
nilaslegIndexwill result in searching for all legs.Declaration
Swift
public func exclusionViolations(routeIndex: Int, legIndex: Int? = nil) -> LazyFilterSequence<[RoadClassExclusionViolation]>Parameters
routeIndexIndex of a route inside current
RouteResponseto search in.legIndexIndex of a leg inside related
Routeto search in.Return Value
Lazy filtered array of
RoadClassExclusionViolationunder given indicies. -
Filters
roadClassExclusionViolationslazily to search for specific leg and step.Passing
nilasstepIndexwill result in searching for all steps.Declaration
Swift
public func exclusionViolations(routeIndex: Int, legIndex: Int, stepIndex: Int? = nil) -> LazyFilterSequence<[RoadClassExclusionViolation]>Parameters
routeIndexIndex of a route inside current
RouteResponseto search in.legIndexIndex of a leg inside related
Routeto search in.stepIndexIndex of a step inside given
Route‘s leg.Return Value
Lazy filtered array of
RoadClassExclusionViolationunder given indicies. -
Filters
roadClassExclusionViolationslazily to search for specific leg, step and intersection.Passing
nilasintersectionIndexwill result in searching for all intersections of given step.Declaration
Swift
public func exclusionViolations(routeIndex: Int, legIndex: Int, stepIndex: Int, intersectionIndex: Int?) -> LazyFilterSequence<[RoadClassExclusionViolation]>Parameters
routeIndexIndex of a route inside current
RouteResponseto search in.legIndexIndex of a leg inside related
Routeto search in.stepIndexIndex of a step inside given
Route‘s leg.intersectionIndexIndex of an intersection inside given
Route‘s leg and step.Return Value
Lazy filtered array of
RoadClassExclusionViolationunder given indicies.
Install in Dash
RouteResponse Structure Reference