Class

XCTKVOExpectation

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

Topics

Creating KVO Expectations

init(keyPath: String, object: Any)

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

init(keyPath: String, object: Any, expectedValue: Any?)

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

init(keyPath: String, object: Any, expectedValue: Any?, options: NSKeyValueObservingOptions = [])

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

var keyPath: String

The key path that is being observed for KVO changes.

var observedObject: Any

The object that is being observed for KVO changes.

var expectedValue: Any?

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

Custom KVO Evaluation

var handler: XCTKVOExpectation.Handler?

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

typealias XCTKVOExpectation.Handler

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

Relationships

Inherits From