OfflineRoutePlanner

public final class OfflineRoutePlanner : RoutePlanner

Offline planner that plans a route from an origin to a destination, passing through waypoints (if specified).

Lifecycle

  • Initializes the OfflineRoutePlanner with NDSStore and optionally, with TrafficService

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public init(store: NDSStore, trafficService: TrafficService? = nil) throws

    Parameters

    store

    NDSStore instance

    trafficService

    Optional TrafficService instance

Public

  • Defines the error cases that can occur while planning a trip.

    See more

    Declaration

    Swift

    public enum PlanError : Error
  • Plans a route according to the parameters set in the RoutePlanningOptions.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func planRoute(
        options: RoutePlanningOptions,
        onRouteReady: ((Route) -> ())?,
        completion: @escaping (Result<RoutePlanningResponse, Error>) -> ()
    )

    Parameters

    options

    RoutePlanningOptions that contains parameters for route planning

    onRouteReady

    Closure executed whenever a route is done planning

    completion

    Closure called when planning is done (successfully or with an error)

  • Cancels all current planning requests.

    Declaration

    Swift

    public func cancelPendingRequests()
  • This function calculates route contents (instructions, lane guidance) within its certain part using the provided RouteIncrementOptions object.

    Note

    Route ETA should be updated outside advanceGuidanceProgress call

    Note

    It’s currently expected that only following Route contents will be updated: Route.legs(i).instructions Route.laneSections

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func advanceGuidanceProgress(with options: RouteIncrementOptions) -> Result<Route, Error>

    Parameters

    options

    The RouteIncrementOptions.

    Return Value

    If the call succeeds, return a Route. If it fails, return an Error.