HybridRoutePlanner
public struct HybridRoutePlanner : RoutePlanner
Hybrid Routing allows you to specify two RoutePlanner
instances,
which will be executed depending on the ExecutionPolicy
provided.
Important
This is a Public Preview API. It may be changed or removed at any time.-
Creates an instance of
HybridRoutePlanner
with given parameters.Declaration
Swift
public init( primaryPlanner: RoutePlanner, alternativePlanner: RoutePlanner, executionPolicy: ExecutionPolicy = .fallback )
Parameters
primaryPlanner
The primary route planner.
alternativePlanner
The secondary route planner.
executionPolicy
The
ExecutionPolicy
that determines how the second planner is used. Defaults tofallback
.
-
Execution policy determines how requests to multiple sources of flows are executed.
See moreDeclaration
Swift
public enum ExecutionPolicy
-
Synchronously plans a route and its alternative routes using the provided
RoutePlanningOptions
object.Declaration
Swift
public func planRoute( options: RoutePlanningOptions, onRouteReady: ((Route) -> ())? = nil, completion: @escaping (Result<RoutePlanningResponse, Error>) -> () )
Parameters
options
The
RoutePlanningOptions
object, containing the route options needed to plan a route.onRouteReady
The onRouteReady closure is called for each route that has been planned successfully.
completion
The completion closure is called after the response to the request has been processed.
-
This function calculates route contents (instructions, lane guidance) within its certain part using the provided
RouteIncrementOptions
object.Note
Route ETA should be updated outside [increment] call.
Note
It’s currently expected that only following Route contents will be updated:
- Route.legs(i).instructions
- Route.sections.laneSections
Declaration
Swift
public func advanceGuidanceProgress(with options: RouteIncrementOptions) -> Result<TomTomSDKRoute.Route, Error>
Parameters
options
The
RoutePlanningOptions
.Return Value
If the call succeeds, return a Route. If it fails, return an Error.
-
Cancels all current requests.
Declaration
Swift
public func cancelPendingRequests()