ViewModel

public final class ViewModel : ObservableObject

ViewModel for the NavigationView. This class is responsible for handling the navigation logic and providing data to the view. It observes the navigation progress, destination arrival, and waypoint arrival.

Important

This is a Public Preview API. It may be changed or removed at any time.
  • Convenience initializer for NavigationView.ViewModel.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public convenience init(
        _ navigation: TomTomNavigation,
        tts: TextToSpeechEngine
    )

    Parameters

    navigation

    Defines the functionality of the navigation.

    tts

    Provides interface of the text-to-speech engine.

  • The destination of the navigation.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var destination: String?
  • The current navigation route.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    @Published
    public private(set) var navigationRoute: TomTomSDKRoute.Route? { get set }
  • The proposed route for navigation.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    @Published
    public private(set) var proposedRoute: TomTomSDKRoute.Route? { get set }
  • If true the language, voice, and accent of guidance announcements is changed to the language specified in the message when the message language is different from the current voice guidance language and the message language is supported.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var adaptVoiceLanguage: Bool
  • If true, the waypoint arrival panel is shown after the waypoint is reached.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var showWaypointArrivalView: Bool
  • Defines the unit system used in navigation. The value is always the same as in Navigation instance passed in initializer.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var unitSystem: UnitSystemType { get set }
  • Starts the instruction and sets the state to instruction.

    Declaration

    Swift

    public func startInstruction()
  • Shows an error with the provided title and message.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func showError(title: String, message: String)

    Parameters

    title

    The title of the error.

    message

    The message of the error.

  • Starts the navigation and sets the state to freedrive.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func start()
  • Starts the navigation with the provided navigation options.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func start(_ navigationOptions: NavigationOptions)

    Parameters

    navigationOptions

    The options to use for starting the navigation.

  • Stops the navigation and clears the navigation route.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func stop()
  • Hides the combined instruction.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func hideCombinedInstruction()
  • Hides the lane icons in the maneuver model.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func hideLanes()
  • Sets the locale for text-to-speech.

    Throws

    An error if the locale cannot be set.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func setTextToSpeechLocale(locale: Locale) throws

    Parameters

    locale

    The locale to set for text-to-speech.

  • Stops the text-to-speech service.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func stopTextToSpeech()
  • Mutes or unmutes the text-to-speech service.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func muteTextToSpeech(mute: Bool)

    Parameters

    mute

    A Boolean value indicating whether to mute the text-to-speech service.