RouteController
open class RouteController: NSObject
A RouteController
tracks the user’s progress along a route, posting notifications as the user reaches significant points along the route. On every location update, the route controller evaluates the user’s location, determining whether the user remains on the route. If not, the route controller calculates a new route.
RouteController
is responsible for the core navigation logic whereas
NavigationViewController
is responsible for displaying a default drop-in navigation UI.
-
The route controller’s delegate.
Declaration
Swift
public weak var delegate: RouteControllerDelegate?
-
The Directions object used to create the route.
Declaration
Swift
public let directions: Directions
-
The route controller’s associated location manager.
Declaration
Swift
public var locationManager: NavigationLocationManager!
-
If true, location updates will be simulated when driving through tunnels or other areas where there is none or bad GPS reception.
Declaration
Swift
public var isDeadReckoningEnabled = false
-
Details about the user’s progress along the current route, leg, and step.
Declaration
Swift
public var routeProgress: RouteProgress
-
If true, the user puck is snapped to closest location on the route. Defaults to false.
Declaration
Swift
public var snapsUserLocationAnnotationToRoute = true
-
Intializes a new
RouteController
.Declaration
Swift
public init(along route: Route, directions: Directions = Directions.shared, locationManager: NavigationLocationManager = NavigationLocationManager())
Parameters
route
The route to follow.
directions
The Directions object that created
route
.locationManager
The associated location manager.
-
Starts monitoring the user’s location along the route.
Will continue monitoring until
suspendLocationUpdates()
is called.Declaration
Swift
public func resume()
-
Stops monitoring the user’s location along the route.
Declaration
Swift
public func suspendLocationUpdates()
-
Given a users current location, returns a Boolean whether they are currently on the route.
If the user is not on the route, they should be rerouted.
Declaration
Swift
public func userIsOnRoute(_ location: CLLocation) -> Bool