RoutingProvider
public protocol RoutingProvider
Protocol which defines a type which can be used for fetching or refreshing routes.
SDK provides conformance to this protocol for Directions and MapboxRoutingProvider.
-
Declaration
Swift
typealias IndexedRouteResponseCompletionHandler = (_ result: Result<IndexedRouteResponse, DirectionsError>) -> Void -
Begins asynchronously calculating routes using the given options and delivers the results to a closure.
Declaration
Swift
@discardableResult func calculateRoutes(options: RouteOptions, completionHandler: @escaping IndexedRouteResponseCompletionHandler) -> NavigationProviderRequest?Parameters
optionsA
RouteOptionsobject specifying the requirements for the resulting routes.completionHandlerThe closure (block) to call with the resulting routes. This closure is executed on the application’s main thread.
Return Value
Related request. If, while waiting for the completion handler to execute, you no longer want the resulting routes, cancel corresponding task using this handle.
-
Begins asynchronously calculating routes using the given options and delivers the results to a closure.
Declaration
Swift
@available(*, deprecated, renamed: "calculateRoutes(options:completionHandler:﹚") @discardableResult func calculateRoutes(options: RouteOptions, completionHandler: @escaping Directions.RouteCompletionHandler) -> NavigationProviderRequest?Parameters
optionsA
RouteOptionsobject specifying the requirements for the resulting routes.completionHandlerThe closure (block) to call with the resulting routes. This closure is executed on the application’s main thread.
Return Value
Related request. If, while waiting for the completion handler to execute, you no longer want the resulting routes, cancel corresponding task using this handle.
-
Begins asynchronously calculating matches using the given options and delivers the results to a closure.
Declaration
Swift
@discardableResult func calculateRoutes(options: MatchOptions, completionHandler: @escaping Directions.MatchCompletionHandler) -> NavigationProviderRequest?Parameters
optionsA
MatchOptionsobject specifying the requirements for the resulting matches.completionHandlerThe closure (block) to call with the resulting matches. This closure is executed on the application’s main thread.
Return Value
Related request. If, while waiting for the completion handler to execute, you no longer want the resulting routes, cancel corresponding task using this handle.
-
Begins asynchronously refreshing the route with the given identifier, starting from an arbitrary leg along the route.
Declaration
Swift
@discardableResult func refreshRoute(indexedRouteResponse: IndexedRouteResponse, fromLegAtIndex: UInt32, completionHandler: @escaping Directions.RouteCompletionHandler) -> NavigationProviderRequest?Parameters
indexedRouteResponseThe
RouteResponseand selectedrouteIndexin it to be refreshed.fromLegAtIndexThe index of the leg in the route at which to begin refreshing. The response will omit any leg before this index and refresh any leg from this index to the end of the route. If this argument is
0, the entire route is refreshed.completionHandlerThe closure (block) to call with updated
RouteResponsedata. Order ofroutesremain unchanged comparing to originalindexedRouteResponse. This closure is executed on the application’s main thread.Return Value
Related request. If, while waiting for the completion handler to execute, you no longer want the resulting routes, cancel corresponding task using this handle.
-
refreshRoute(indexedRouteResponse:fromLegAtIndex:currentRouteShapeIndex:currentLegShapeIndex:completionHandler:)Begins asynchronously refreshing the route with the given identifier, starting from an arbitrary leg and shape index along the route.
Declaration
Swift
@discardableResult func refreshRoute(indexedRouteResponse: IndexedRouteResponse, fromLegAtIndex: UInt32, currentRouteShapeIndex: Int, currentLegShapeIndex: Int, completionHandler: @escaping Directions.RouteCompletionHandler) -> NavigationProviderRequest?Parameters
indexedRouteResponseThe
RouteResponseand selectedrouteIndexin it to be refreshed.fromLegAtIndexThe index of the leg in the route at which to begin refreshing. The response will omit any leg before this index and refresh any leg from this index to the end of the route.
currentRouteShapeIndexIndex relative to
fromLegAtIndexleg shape, representing the point the user is currently located at.currentRouteShapeIndexIndex relative to
fromLegAtIndexleg shape, representing the point the user is currently located at.completionHandlerThe closure (block) to call with updated
RouteResponsedata. Order ofroutesremain unchanged comparing to originalindexedRouteResponse. This closure is executed on the application’s main thread.Return Value
Related request. If, while waiting for the completion handler to execute, you no longer want the resulting routes, cancel corresponding task using this handle.
Install in Dash
RoutingProvider Protocol Reference