LaneGuidanceUpdateObserver
public protocol LaneGuidanceUpdateObserver : Observer
Informs the caller about changes in lane guidance. This interface provides an observer for 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 called, 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.
-
Called when new lane guidance appears.
This method is called when the next lane guidance becomes available during the journey. This enables real-time update of lane guidance for the user.
This method is called 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.
-
Called when current lane guidance ends.
This method is called 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.