THIS SDK ISDEPRECATED.

We rolled out a new and better SDK for you.

Documentation

This component integrates the Routing API service described on https://developer.tomtom.com/routing-api/documentation/routing/calculate-route. The service calculates a route between an origin and a destination, passing through waypoints if they are specified.

The Routing API is one of our most advanced APIs, enabling the user to calculate a perfect path from point A to point B.

  • TTRouteQueryBuilder is used to construct a Request to the Routing API service for planning a route.
  • You can set an origin and a destination if you want to route from the current location, then simply pass it to the from() method of the TTRouteQueryBuilder.
  • You can set a list of via points to lead the way though them.
  • You can provide locations as points, or as approximate points (circles).

Import the TTRouteResponseDelegate. Before releasing a Routing object for which you have set a delegate, remember to set that object’s delegate property to nil.

class RouteViewController: UIViewController, TTRouteResponseDelegate {}
@interface RouteViewController () < TTRouteResponseDelegate>

Add your implementation of the protocol method completedWithResult:

func route(_: TTRoute, completedWith result: TTRouteResult) {
}
- (void)route:(TTRoute *)route completedWithResult:(TTRouteResult *)result {
}

Add your implementation of the protocol method completedWithResponseError:

func route(_: TTRoute, completedWith responseError: TTResponseError) {
}
- (void)route:(TTRoute *)route completedWithResponseError:(TTResponseError *)responseError {
}

Add a delegate on viewDidLoad:

1override func viewDidLoad() {
2 super.viewDidLoad()
3 routePlanner.delegate = self
4}
1- (void)viewDidLoad {
2 [super viewDidLoad]
3 self.routePlanner = [[TTRoute alloc] initWithKey:Key.Routing];
4 self.routePlanner.delegate = self;
5}