LaneGuidanceUpdateObserver
public protocol LaneGuidanceUpdateObserver : Observer
Declares an observer that can receive changes when lane guidance starts and ends.
The LaneGuidanceUpdateObserver
interface provides the methods that are called when lane guidance
shall appear and disappear, respectively. These methods facilitate efficient and dynamic update
of lane guidance information during a journey.
To observe the lane guidance changes, first implement this interface to create an observer, for example:
class CustomLaneGuidanceObserver: LaneGuidanceUpdateObserver {
func didStartLaneGuidance(laneGuidance: LaneGuidance) {
// Add code here that handles the lane guidance starting
}
func didEndLaneGuidance(laneGuidance: LaneGuidance) {
// Add code here that handles the lane guidance ending
}
}
Then add the observer using addLaneGuidanceUpdateObserver(_:)
.
To stop observation of the lane guidance changes,
remove the observer using removeLaneGuidanceUpdateObserver(_:)
.
Note
To ensure these methods are notified, theRoute
passed to TomTomNavigation
must contain valid LaneSection
s. This code is used within the context of a navigation
system where lane guidance is crucial for the user experience and journey accuracy.
-
Notifies when new lane guidance appears.
This method is notified when the next lane guidance becomes available during the journey. This enables real-time update of lane guidance for the user.
This method is notified when the
Route
passed toTomTomNavigation
contains validLaneSection
s, and the navigation system transitions to a new lane guidance.Declaration
Swift
func didStartLaneGuidance(laneGuidance: LaneGuidance)
Parameters
laneGuidance
Provides detailed information about the new lane guidance.
-
Notifies when current lane guidance ends.
This method is notified when the current lane guidance is no longer applicable. This allows for the timely removal or update of lane guidance information on the user interface.
Declaration
Swift
func didEndLaneGuidance(laneGuidance: LaneGuidance)
Parameters
laneGuidance
Provides detailed information about the lane guidance that just ended.