expectation(that:on:options:willSatisfy:)
Creates an expectation using key-value observing to monitor changes to a given key path on a given object.
Declaration
func expectation<T, V>(that keyPath: KeyPath<T, V>, on observedObject: T, options: NSKeyValueObservingOptions = [.initial, .new, .old], willSatisfy filter: XCTKeyPathExpectation<T, V>.AsynchronousFilter? = nil) -> XCTKeyPathExpectation<T, V> where T : NSObject, T : Sendable, V : SendableParameters
- keyPath:
The key path to observe.
- observedObject:
The object to observe the key path on.
- options:
Options to pass to Foundation when observing changes.
- filter:
An asyncronous predicate function you use to test observed changes to a key path. If
nil, the first observed change fulfills the expectation.
Return Value
Creates and returns an expectation associated with the test case that a specific key-value observing (KVO) condition fulfills, see Using Key-Value Observing in Swift.
See Also
Creating Asynchronous Test Expectations
expectation(description:)expectation(for:evaluatedWith:handler:)expectation(forNotification:object:handler:)expectation(forNotification:object:notificationCenter:handler:)keyValueObservingExpectation(for:keyPath:expectedValue:)expectation(that:on:options:willEqual:)keyValueObservingExpectation(for:keyPath:handler:)expectation(that:on:options:willSatisfy:)expectation(that:on:options:willSatisfy:)