RouteControllerDelegate
public protocol RouteControllerDelegate: class
The RouteControllerDelegate
class provides methods for responding to significant occasions during the user’s traversal of a route monitored by a RouteController
.
-
Returns whether the route controller should be allowed to calculate a new route.
If implemented, this method is called as soon as the route controller detects that the user is off the predetermined route. Implement this method to conditionally prevent rerouting. If this method returns
true
,routeController(_:willRerouteFrom:)
will be called immediately afterwards.Declaration
Swift
optional func routeController(_ routeController: RouteController, shouldRerouteFrom location: CLLocation) -> Bool
Parameters
routeController
The route controller that has detected the need to calculate a new route.
location
The user’s current location.
Return Value
True to allow the route controller to calculate a new route; false to keep tracking the current route.
-
Called immediately before the route controller calculates a new route.
This method is called after
routeController(_:shouldRerouteFrom:)
is called, simultaneously with theRouteControllerWillReroute
notification being posted, and beforerouteController(_:didRerouteAlong:)
is called.Declaration
Swift
optional func routeController(_ routeController: RouteController, willRerouteFrom location: CLLocation)
Parameters
routeController
The route controller that will calculate a new route.
location
The user’s current location.
-
Called immediately after the route controller receives a new route.
This method is called after
routeController(_:willRerouteFrom:)
and simultaneously with theRouteControllerDidReroute
notification being posted.Declaration
Swift
optional func routeController(_ routeController: RouteController, didRerouteAlong route: Route)
Parameters
routeController
The route controller that has calculated a new route.
route
The new route.
-
Called when the route controller fails to receive a new route.
This method is called after
routeController(_:willRerouteFrom:)
and simultaneously with theRouteControllerDidFailToReroute
notification being posted.Declaration
Swift
optional func routeController(_ routeController: RouteController, didFailToRerouteWith error: Error)
Parameters
routeController
The route controller that has calculated a new route.
error
An error raised during the process of obtaining a new route.
-
Called when the route controller’s location manager receive a location update.
These locations can be modified due to replay or simulation but they can also derive from regular location updates from a
CLLocationManager
.Declaration
Swift
optional func routeController(_ routeController: RouteController, didUpdateLocations locations: [CLLocation])
Parameters
routeController
The route controller that received the new locations.
locations
The locations that were received from the associated location manager.