UpdatableProperty

public protocol UpdatableProperty : Property
  • Updates the value backing this Property.

    Declaration

    Swift

    @discardableResult
    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.

  • updateValue(_:) Extension method

    Updates the value backing this Property to the provided value, with the date set to the current date and time.

    Declaration

    Swift

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

    Parameters

    value

    The new value of the property.

    Return Value

    The new snapshot.

Available where Value: Equatable

  • Updates the value backing this Property, only if the provided value is different.

    Declaration

    Swift

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

    Parameters

    value

    The new value.

    date

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

    Return Value

    The new snapshot, or nil if the value was not different.