Contents

XCTKeyPathExpectation.Predicate

A function the key path expectation uses to test the value of an observed property.

Declaration

typealias Predicate = @Sendable (T, NSKeyValueObservedChange<V>) async -> Bool

Parameters

  • observedObject:

    The observed object to evaluate with the property that changes.

  • change:

    A value that describes the observed change.

Return Value

Returns true if the change fulfills the expectation; otherwise, false.

Discussion

A key path expectation uses this function to determine whether the value of the observed property fulfills the conditions of the expectation. The system invokes the function asyncronously on a detached task and may call the function more that once.

See Also

Creating key path expectations