MeasurementProperty
@propertyWrapper
public final class MeasurementProperty<Unit> : UpdatableProperty, Equatable where Unit : Unit
-
Declaration
Swift
public typealias Value = Measurement<Unit> -
Declaration
Swift
public static func == (lhs: MeasurementProperty<Unit>, rhs: MeasurementProperty<Unit>) -> Bool -
Declaration
Swift
public var wrappedValue: Value { get set } -
Declaration
Swift
public var projectedValue: ReadOnlyProperty<MeasurementProperty<Unit>> { get }
-
A human-friendly display name that describes the property.
Declaration
Swift
public let displayName: String -
A formatter that can be used to build a human-friendly string from the value.
Declaration
Swift
public let formatter: MeasurementFormatter
-
Declaration
Swift
public var measurement: Measurement<Unit> { get } -
Declaration
Swift
public var unit: Unit { get } -
Declaration
Swift
public var measuredValue: Double { get }
-
Declaration
Swift
public init( displayName: String, measurement: Measurement<Unit>, formatter: MeasurementFormatter = MeasurementFormatter(), date: Date = Date() ) -
Declaration
Swift
public convenience init( displayName: String, value: Double, unit: Unit, formatter: MeasurementFormatter = MeasurementFormatter(), date: Date = Date() )
-
Updates the value backing this
Property, only if the provided value is different.Declaration
Parameters
valueThe new value.
dateThe date and time the
valuewas recorded. Defaults to the current date and time.Return Value
The new snapshot, or
nilif the value was not different.
View on GitHub
MeasurementProperty Class Reference