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)
-
updateValueIfDifferent(_:
Extension methoddate: ) 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.