-
Notifications
You must be signed in to change notification settings - Fork 2
Navigation module
Navigation module offers you navigating from point A to point B. You must calculate route and then you can navigate on that route. The module provides current speed, speed limits, signposts, lane assistance, etc.
Inputs and outputs of the module serve as quick look for possibilities you can do with the module. For more information look at code and its documentation.
route: SYRoute?
- route you are navigate on, if it's nil, you just drive without the road
preview: Bool
- with preview on, navigation is simulated
useLaneAssist: Bool
- simulates road lanes to help driver stay on correct side of the road
useCurrentSpeed: Bool
- shows current speed of vehicle
useSpeedLimit: Bool
- shows speed limits on roads if available
useInfobar: Bool
- shows infobar with custom information, for example ETA, time, etc.
leftInfobarButton: SYUIActionButton?
- left button in infobar
rightInfobarButton: SYUIActionButton?
- right button in infobar
instructionsType: Enum (.direction, .signpost, .none)
- type of view for instructions, .direction
shows direction arrow, distance, street name and .signpost
also simulates signposts on the road
units: Enum (.kilometers, .milesFeet, .milesYards)
- units used in current speed etc.
audioEnabled: Bool
- audio instructions
navigationController(_ controller: SYMKNavigationViewController, didUpdate mapState: SYMKMapState)
Calls every time map state is updated
navigationController(_ controller: SYMKNavigationViewController, didStartNavigatingWith mapRoute: SYMapRoute)
Navigation start event
navigationControllerDidStopNavigating(_ controller: SYMKNavigationViewController)
Navigation stop event
navigationController(_ controller: SYMKNavigationViewController, didFindBetterRoute route: SYAlternativeRoute)
Better alternative route was found
navigationController(_ controller: SYMKNavigationViewController, didPassWaypoint: SYWaypoint, at index: UInt)
If route contains waypoints, this is called after passing some.
navigationControllerDidReachFinish(_ controller: SYMKNavigationViewController)
Navigation reached finish
Example with predefined route and preview mode enabled.
It's possible to initiate and present empty navigation controller without route and start navigating after.
let navigation = SYMKNavigationViewController()
...
// obtain SYRoute from SYRouting
...
navigation.startNavigation(with route: SYRoute, preview: true)
Or initiate controller with existing SYRoute
and navigation starts automatically.
let navigation = SYMKNavigationViewController(with: existingRoute)
Example tries to compute route from your current location to predefined destination in Rome and start navigating. In this case, preview mode is disabled.
This sample interactively demonstrates all available instructions types. You can choose between simple direction or more complex signpost type or turn instructions off completely by selecting none.
let navigation = SYMKNavigationViewController()
navigation.instructionsType = .signpost
Instruction types
- .none
- .direction
- .signpost
Example how to change predefined buttons inside infobar.
let superCustomButton = SYUIActionButton()
// any button customizations
...
let navigation = SYMKNavigationViewController()
navigation.leftInfobarButton = superCustomButton