NavigationWaypointArrivalObserver
public protocol NavigationWaypointArrivalObserver : Observer
Declares an observer that can receive 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 CustomNavigationWaypointArrivalObserver: 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 add this observer using
addWaypointArrivalObserver(_:)
.
To stop receiving these events, remove the observer using
removeWaypointArrivalObserver(_:)
.