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
Waypoint
objects in the order of the input coordinates. EachWaypoint
is an input coordinate snapped to the road and path network.This property omits the waypoint corresponding to any waypoint in
RouteOptions.waypoints
that hasWaypoint.separatesLegs
set 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
RouteResponse
object 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.responseEndDate
property instead. This property may also be set tonil
if 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
RoadClasses
restrictions specified toRouteOptions.roadClassesToAvoid
which were violated during route calculation.Routing engine may still utilize
RoadClasses
meant to be avoided in cases when routing is impossible otherwise.Violations are ordered by routes from the
routes
array, then by a leg, step, and intersection, whereRoadClasses
restrictions were ignored.nil
and empty return arrays correspond tonil
and emptyroutes
array 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
roadClassExclusionViolations
lazily to search for specific leg and step.Passing
nil
aslegIndex
will result in searching for all legs.Declaration
Swift
public func exclusionViolations(routeIndex: Int, legIndex: Int? = nil) -> LazyFilterSequence<[RoadClassExclusionViolation]>
Parameters
routeIndex
Index of a route inside current
RouteResponse
to search in.legIndex
Index of a leg inside related
Route
to search in.Return Value
Lazy filtered array of
RoadClassExclusionViolation
under given indicies. -
Filters
roadClassExclusionViolations
lazily to search for specific leg and step.Passing
nil
asstepIndex
will result in searching for all steps.Declaration
Swift
public func exclusionViolations(routeIndex: Int, legIndex: Int, stepIndex: Int? = nil) -> LazyFilterSequence<[RoadClassExclusionViolation]>
Parameters
routeIndex
Index of a route inside current
RouteResponse
to search in.legIndex
Index of a leg inside related
Route
to search in.stepIndex
Index of a step inside given
Route
‘s leg.Return Value
Lazy filtered array of
RoadClassExclusionViolation
under given indicies. -
Filters
roadClassExclusionViolations
lazily to search for specific leg, step and intersection.Passing
nil
asintersectionIndex
will 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
routeIndex
Index of a route inside current
RouteResponse
to search in.legIndex
Index of a leg inside related
Route
to search in.stepIndex
Index of a step inside given
Route
‘s leg.intersectionIndex
Index of an intersection inside given
Route
‘s leg and step.Return Value
Lazy filtered array of
RoadClassExclusionViolation
under given indicies.