NavigationWaypointArrivalObserver
public protocol NavigationWaypointArrivalObserver : Observer
An observer that receives navigation events related with visiting waypoints.
The waypoint arrival state changes are detected by the TomTomSDKNavigationEngines/ArrivalDetectionEngine
.
Different observer methods are called depending on what state has been detected by the TomTomSDKNavigationEngines/ArrivalDetectionEngine
:
didArriveAtWaypoint(waypoint:on:)
is received when theTomTomSDKNavigationEngines/ArrivalDetectionEngine
detects an arrival at a waypoint.didDepartFromWaypoint(waypoint:on:)
is received when theTomTomSDKNavigationEngines/ArrivalDetectionEngine
detects a departure from a waypoint.
To be notified about the waypoint arrival events while navigating, first
implement the NavigationWaypointArrivalObserver
protocol:
class NavigationWaypointArrivalObserverImpl: NavigationWaypointArrivalObserver {
func didArriveAtWaypoint(waypoint: RouteStop, on route: Route) {
// Add code here that handles an arrival at a waypoint.
}
func didDepartFromWaypoint(waypoint: RouteStop, on route: Route) {
// Add code here that handles a departure from a waypoint.
}
}
Then register this observer using
addWaypointArrivalObserver(_:)
.
To stop receiving these events, unregister the observer using
removeWaypointArrivalObserver(_:)
.
-
Called when arrival is detected at the given waypoint. It marks the start of the waypoint arrival experience.
Declaration
Swift
func didArriveAtWaypoint(waypoint: RouteStop, on route: Route)
Parameters
waypoint
The waypoint that has been reached.
route
The current route.
-
Called when a departure is detected from the given waypoint. It marks the end of the waypoint arrival experience.
Declaration
Swift
func didDepartFromWaypoint(waypoint: RouteStop, on route: Route)
Parameters
waypoint
The waypoint from where the driver departed.
route
The current route.