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 the RouteControllerWillReroute notification being posted, and before routeController(_: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 when a location has been discarded for being inaccurate.

    See CLLocation.isQualified for more information about what qualifies a location.

    Declaration

    Swift

    optional func routeController(_ routeController: RouteController, didDiscard location: CLLocation)

    Parameters

    routeController

    The route controller that discarded the location.

    location

    The location that was discarded

  • Called immediately after the route controller receives a new route.

    This method is called after routeController(_:willRerouteFrom:) and simultaneously with the RouteControllerDidReroute 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 the RouteControllerDidFailToReroute 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, didUpdate locations: [CLLocation])

    Parameters

    routeController

    The route controller that received the new locations.

    locations

    The locations that were received from the associated location manager.

  • Called when the route controller arrives at a waypoint.

    Declaration

    Swift

    optional func routeController(_ routeController: RouteController, didArriveAt waypoint: Waypoint)

    Parameters

    waypoint

    The waypoint that the controller has arrived at.

    finalDestination

    A boolean flag that signals that the waypoint is the final destination.