Contents

expectation(that:on:options:willEqual:)

Creates an expectation using key-value observing the test fulfills when the value of an observed property changes to an expected value.

Declaration

func expectation<T, V>(that keyPath: KeyPath<T, V>, on observedObject: T, options: NSKeyValueObservingOptions = [.initial, .new, .old], willEqual expectedValue: V) -> XCTKeyPathExpectation<T, V> where T : NSObject, V : Equatable

Parameters

  • keyPath:

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

  • observedObject:

    The object to observe the key path on.

  • options:

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

  • expectedValue:

    A value the property must equal to fulfill the expectation.

Return Value

Creates and returns an expectation for the test case.

See Also

Creating Asynchronous Test Expectations