If I have a route calculated from point A to point B using the following code:
[SKRoutingService sharedInstance].routingDelegate = self;
[SKRoutingService sharedInstance].navigationDelegate = self;
[SKRoutingService sharedInstance].mapView = _mapView;
SKRouteSettings* route = [[SKRouteSettings alloc]init];
route.startCoordinate=CLLocationCoordinate2DMake([Constants shared].location.x, [Constants shared].location.y);
route.destinationCoordinate=CLLocationCoordinate2DMake([Constants shared].destination.x, [Constants shared].destination.y);
route.shouldBeRendered = YES;
SKNavigationSettings* navSettings = [SKNavigationSettings navigationSettings];
navSettings.navigationType=SKNavigationTypeSimulation;
navSettings.distanceFormat=SKDistanceFormatMilesFeet;
[SKRoutingService sharedInstance].mapView.settings.displayMode = SKMapDisplayMode2D;
[[SKRoutingService sharedInstance] calculateRoute:route];
And the above is all fine. Route will be calculated and display with no problem. But how do I add a viaPoint to the already calculated route? Do I need to clear the already created one and calculate new one, or somehow recalculate the existing one with another point added.
And another question, how do I properly create a SKViaRoute object?
If you want to calculate a route with via points you need to populate the viaPoints array in the routeSettings.
If you want to add or remove a via point from an already existing route you want to use the addViaPoint / removeViaPoint methods.