Skip to main content

Routing plugin

The routing plugin allows you to generate safe and legal routes for commercial vehicles and display those routes on the map. To use the plugin:

To add the dependency, configure your Cartfile as follows:

# Latest release
binary "" == 1.0.1
binary "" == 1.0.1
binary "" == 1.0.0
github "raphaelmor/Polyline" ~> 5.0

When initializing the RoutePlugin, you pass it the TMGLMapView that the plugin will draw routes on.

routePlugin = RoutePlugin(mapView: mapView)

How to generate a route

In order to use the route plugin, you must first create a route to pass in. To generate a route, you need to define and initiate the RouteOptions with a list of all stops in the trip.

let options = RouteOptions(waypoints: [startPoint, stopPoint, endPoint])
let route = Route()
route.routeOptions = options

Once we have a valid route, we can pass that route into the RoutePlugin and it will draw the route on the map.

Last updated December 20, 2023.