Contents

expectation(that:on:options:willSatisfy:)

Creates an expectation using key-value observing the test fulfills when the value of an observed property changes and satisfies the conditions of a predicate’s evaluation.

Declaration

func expectation<T, V>(that keyPath: KeyPath<T, V>, on observedObject: T, options: NSKeyValueObservingOptions = [.initial, .new, .old], willSatisfy predicate: XCTKeyPathExpectation<T, V>.Predicate? = nil) -> XCTKeyPathExpectation<T, V> where T : NSObject

Parameters

  • keyPath:

    The key path for the observed property, relative to the observed object.

  • observedObject:

    The object to observe the property on.

  • options:

    A combination of values that specify what to include in observation notifications. For possible values, see Nskeyvalueobservingoptions.

  • predicate:

    A closure that evaluates the observed object. If nil, the first observed change fulfills the expectation.

Return Value

Creates and returns an expectation for the test case.

See Also

Creating Asynchronous Test Expectations