SpeedLimitViewModel

public final class SpeedLimitViewModel : ObservableObject, Equatable

A view model that represents the speed limit information.

Important

This is a Public Preview API. It may be changed or removed at any time.
  • Initializes a new instance of SpeedLimitViewModel with a speed threshold.

    Important

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

    Declaration

    Swift

    public init(speedThreshold: Measurement<UnitSpeed>)

    Parameters

    speedThreshold

    The speed threshold for the view model.

  • Initializes a new instance of SpeedLimitViewModel with speed, optional speed limit, and speed threshold.

    Important

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

    Declaration

    Swift

    public init(
        speed: Measurement<UnitSpeed>,
        speedLimit: Measurement<UnitSpeed>? = nil,
        speedThreshold: Measurement<UnitSpeed>
    )

    Parameters

    speed

    The current speed.

    speedLimit

    The optional speed limit.

    speedThreshold

    The speed threshold for the view model.

  • Initializes a new instance of SpeedLimitViewModel with speed, optional speed limit, speed threshold, and speed unit.

    Important

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

    Declaration

    Swift

    public init(
        speed: Measurement<UnitSpeed>,
        speedLimit: Measurement<UnitSpeed>? = nil,
        speedThreshold: Measurement<UnitSpeed>,
        speedUnit: UnitSpeed
    )

    Parameters

    speed

    The current speed.

    speedLimit

    The optional speed limit.

    speedThreshold

    The speed threshold for the view model.

    speedUnit

    The unit of speed.

  • The current speed of the vehicle.

    Important

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

    Declaration

    Swift

    @Published
    public var speed: Measurement<UnitSpeed> { get set }
  • The optional speed limit for the vehicle.

    Important

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

    Declaration

    Swift

    @Published
    public var speedLimit: Measurement<UnitSpeed>? { get set }
  • A Boolean value indicating whether the speed limit is visible.

    Important

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

    Declaration

    Swift

    @Published
    public var isVisible: Bool { get set }
  • The unit of speed measurement.

    Important

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

    Declaration

    Swift

    @Published
    public var speedUnit: UnitSpeed { get set }
  • Compares two SpeedLimitViewModel instances for equality.

    Important

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

    Declaration

    Swift

    public static func == (lhs: SpeedLimitViewModel, rhs: SpeedLimitViewModel) -> Bool

    Parameters

    lhs

    The left-hand side SpeedLimitViewModel instance.

    rhs

    The right-hand side SpeedLimitViewModel instance.

    Return Value

    A Boolean value indicating whether the two instances are equal.

  • Resets the speed, speed limit, and visibility to their default values.

    Important

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

    Declaration

    Swift

    public func reset()