RoutePlanner
public protocol RoutePlanner
RoutePlanner protocol
-
This planner calculates a route between an origin and a destination, passing through waypoints (if specified). Additional routing parameters like traffic, parts of the road to avoid, departure/arrival time, etc. can be taken into account using
RoutePlanningOptions
.Declaration
Swift
func planRoute( options: RoutePlanningOptions, onRouteReady: ((TomTomSDKRoute.Route) -> ())?, 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. If no errors occurred,
RoutingResponse
contains an array of routes between an origin and a destination. -
Cancels all current requests.
Declaration
Swift
func cancelPendingRequests()
-
This planner 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.laneSections
Declaration
Swift
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.