Class

XCTKVOExpectation

An expectation that is fulfilled when a Key Value Observing (KVO) condition is met.

Declaration

@interface XCTKVOExpectation : XCTestExpectation

Topics

Creating KVO Expectations

- initWithKeyPath:object:

Creates an expectation that is fulfilled by any KVO change to the specified key path of the observed object.

- initWithKeyPath:object:expectedValue:

Creates an expectation that is fulfilled when a KVO change causes the specified key path of the observed object to have an expected value.

- initWithKeyPath:object:expectedValue:options:

Creates an expectation that is fulfilled when a KVO change causes the specified key path of the observed object to have an expected value. Allows custom observation options to be provided by the caller.

Expectation Properties

keyPath

The key path that is being observed for KVO changes.

observedObject

The object that is being observed for KVO changes.

expectedValue

The value that the expectation is waiting for the observed key path to take.

options

The NSKeyValueObservingOptions used when registering for observation.

Custom KVO Evaluation

handler

An optional handler that performs custom evaluation of changes to the observed key path.

XCKeyValueObservingExpectationHandler

A custom handler to be called when a KVO change is observed for a specified key path.

Relationships

Inherits From