OnlineRoutePlanner
public final class OnlineRoutePlanner : RoutePlanner
The Online Route Planner is a REST wrapper for a suite of web services that allow developers to use our scalable routing engine.
-
Declaration
Swift
public convenience init(apiKey: String)Parameters
apiKeyA valid TomTom Service API Key.
-
Initializer with the option to specify a Base URL.
Declaration
Swift
public convenience init(baseURL: String, apiKey: String)Parameters
baseURLA base URL to use for requests. Without the endpoint, as String. An example: “https://api.tomtom.com/routing/1”. The base URL should support the endpoints “calculateRoute” and “calculateLongDistanceEVRoute”.
apiKeyA valid TomTom Service API Key.
-
This function calculates a route between an origin and a destination, passing through waypoints (if specified). Additional routing parameters like traffic, things to avoid, departure/arrival time, etc. can be taken into account using
RoutePlanningOptions.Declaration
Swift
public func planRoute( options: RoutePlanningOptions, onRouteReady: ((Route) -> ())?, completion: @escaping (Result<RoutePlanningResponse, Error>) -> () )Parameters
optionsThe
RoutePlanningOptionswith parameters for the requestonRouteReadyThe onRouteReady closure is not used. Online incremental path alternatives are not implemented.
completionThe completion closure is called on the main queue after the response to the request has been processed. If no errors occurred,
RoutingResponsecontains an array of routes between an origin and a destination. The error type isRoutingError -
Cancels all current requests.
Declaration
Swift
public func cancelPendingRequests() -
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
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
optionsThe
RoutePlanningOptions.Return Value
If the call succeeds, return a
Route. If it fails, return anError.
TomTom SDK for iOS (0.53.1)
OnlineRoutePlanner