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
HybridRoutePlannerwith given parameters.Declaration
Swift
public init( primaryPlanner: RoutePlanner, alternativePlanner: RoutePlanner, executionPolicy: ExecutionPolicy = .fallback )Parameters
primaryPlannerThe primary route planner.
alternativePlannerThe secondary route planner.
executionPolicyThe
ExecutionPolicythat 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
RoutePlanningOptionsobject.Declaration
Swift
public func planRoute( options: RoutePlanningOptions, onRouteReady: ((Route) -> ())? = nil, completion: @escaping (Result<RoutePlanningResponse, Error>) -> () )Parameters
optionsThe
RoutePlanningOptionsobject, containing the route options needed to plan a route.onRouteReadyThe onRouteReady closure is called for each route that has been planned successfully.
completionThe 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
RouteIncrementOptionsobject.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
optionsThe
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()
TomTom SDK for iOS (0.53.1)
HybridRoutePlanner