struct StateChangeEvent<T> where T : TraitA state change event for a given trait.
-
The type ID of the trait that changed.
Declaration
Swift
let typeID: String -
The previous value of the trait, if any.
Declaration
Swift
let oldValue: T? -
The new value of the trait.
Declaration
Swift
let newValue: T -
Computes strongly-typed changes for a specific property.
Returns
nilif the property did not change, or if there is no previous state andignoreNilOldValueistrue.Declaration
Swift
func change<Value>(for keyPath: KeyPath<T, Value>, ignoreNilOldValue: Bool = false) -> ValueChange<Value>? where Value : Equatable, Value : SendableParameters
ignoreNilOldValueIf
true, returnsnilwhen there is no previous state to compare against.Return Value
A
ValueChangeif the property changed, otherwisenil.