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.

  • Routing caluclation method.

    Declaration

    Swift

    @discardableResult
    func calculateRoutes(options: RouteOptions,
                         completionHandler: @escaping Directions.RouteCompletionHandler) -> NavigationProviderRequest?

    Parameters

    options

    A RouteOptions object specifying the requirements for the resulting routes.

    completionHandler

    The 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.

  • Map matching calculation method.

    Declaration

    Swift

    @discardableResult
    func calculateRoutes(options: MatchOptions,
                         completionHandler: @escaping Directions.MatchCompletionHandler) -> NavigationProviderRequest?

    Parameters

    options

    A MatchOptions object specifying the requirements for the resulting matches.

    completionHandler

    The 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.

  • Route refreshing method.

    Declaration

    Swift

    @discardableResult
    func refreshRoute(indexedRouteResponse: IndexedRouteResponse,
                      fromLegAtIndex: UInt32,
                      completionHandler: @escaping Directions.RouteCompletionHandler) -> NavigationProviderRequest?

    Parameters

    indexedRouteResponse

    The RouteResponse and selected routeIndex in it to be refreshed.

    fromLegAtIndex

    The 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 omitted, the entire route is refreshed.

    completionHandler

    The closure (block) to call with updated RouteResponse data. Order of routes remain unchanged comparing to original indexedRouteResponse. 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.