Creates an expectation that uses Key Value Observing to observe a value and respond to changes in that value by calling a provided handler.
- Xcode 7.2+
The object to observe.
The key path to observe.
XCTKVOExpectationblock. If you do not provide a handler block, the expectation will be fulfilled by the first change to the key path of the observed object.
XCTest that uses Key Value Observing to observe changes on the value specified by
key on the provided object.
When changes to the value are detected, the
handler block is called to assess the new value to see if the expectation has been fulfilled. Every Key Value Observing change will run the handler block until it either returns
true (to fulfill the expectation), or the wait times out.
XCTAssert and related APIs can be used in the block to report a failure.