TomTomRoutingService
public final class TomTomRoutingService : RoutingService, EVRoutingService, ReachableRangeRoutingService
extension TomTomRoutingService: AdditionalQueryItemProvider
The TomTom Routing Service is a REST wrapper for a suite of web services that allow developers to use our scalable routing engine.
Important
This is a Public Preview API. It may be changed or removed at any time.-
Initializer with the option to specify a Base URL
Declaration
Swift
public convenience init(baseURL: String)
Parameters
baseURL
A base URL to use for requests. An example: https://custom.api.com
-
Initializer with the option to specify a HTTP Client
Declaration
Swift
public init(httpClient: HTTPHandlerProtocol)
Parameters
httpClient
A http client to use for requests.
-
This service 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
RoutingOptions
.Declaration
Swift
public func planRoute( options: TomTomSDKRouting.RoutingOptions, completion: @escaping (Result<RoutingResponse, Error>) -> () )
Parameters
options
The
RoutingOptions
with parameters for the requestcompletion
The completion closure is called on the main queue 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. The error type isRoutingError
-
This service calculates a set of locations that can be reached from the origin point, subject to the available fuel or energy budget that is specified in the
ReachableRangeOptions
.Declaration
Swift
public func reachableRangeRoute( options: ReachableRangeOptions, completion: @escaping (Result<ReachableRangeResponse, Error>) -> () )
Parameters
query
The
ReachableRangOptions
objects.completion
The completion closure is called on the main queue after the response to the request has been processed. If no errors have occurred,
ReachableRangeResponse
contains a polygon boundary in counterclockwise orientation and the precise polygon center (the result of map-matching the origin point). -
The Long Distance EV Routing service calculates a route between a given origin and destination. The route contains charging stops that have been added automatically based on the vehicle’s consumption and charging model.
Declaration
Swift
public func calculateEvRoute( options: EVRoutingOptions, completion: @escaping (Result<RoutingResponse, Error>) -> () )
Parameters
options
The
EvRoutingOptions
objects.completion
The completion closure is called on the main queue after the response to the request has been processed. If no errors have occurred,
RoutingResponse
contains array of routes between an origin and a destination. -
Declaration
Swift
public func cancelPendingRequests()