BasicProperty

@propertyWrapper
open class BasicProperty<Value, Formatter> : UpdatableProperty where Formatter : Formatter
extension BasicProperty: Equatable where Value: Equatable

Property Requirements

  • A human-friendly display name that describes the property.

    Declaration

    Swift

    public let displayName: String
  • The latest snapshot of data.

    Declaration

    Swift

    @Published
    public internal(set) var snapshot: Snapshot<Value> { get set }
  • The current value of the property.

    Declaration

    Swift

    public internal(set) var value: Value { get set }
  • A formatter that can be used to build a human-friendly string from the value.

    Declaration

    Swift

    public let formatter: Formatter
  • Declaration

    Swift

    public var snapshotsPublisher: AnyPublisher<Snapshot<Value>, Never> { get }

Initialisers

Update Functions

  • Updates the value backing this Property.

    Declaration

    Swift

    @discardableResult
    public func updateValue(
        _ value: Value,
        date: Date
    ) -> Snapshot<Value>

    Parameters

    value

    The new value of the property.

    date

    The date and time the value was recorded. Defaults to the current date and time.

    Return Value

    The new snapshot.

Available where Value: Equatable

  • Declaration

    Swift

    public static func == (
        lhs: BasicProperty<Value, Formatter>, rhs: BasicProperty<Value, Formatter>
    ) -> Bool

Available where Value: ExpressibleByNilLiteral