Im trying to use 3 waypoints in mapbox navigation. When I run my app, It starts at the middle point, start rerouting, and then provides a route from my first to last point.
So to make things cleared. If i want to go from Los Angeles, stop at las vegas, and then end my trip at San francisco. What it is doing is: Starts route at Las vegas, reroutes, and then starts route from los angeles to san francisco. This is my code.
self.routeOptions = NavigationRouteOptions(waypoints: allPoints)
Directions.shared.calculate(routeOptions!) { (session, result) in
switch result {
case .failure(let error):
print(error.localizedDescription)
case .success(let response):
guard let route = response.routes?.first else{
return
}
self.route = route
}
}