Contents

wait(for:enforceOrder:)

Creates a waiter that waits on a group of expectations optionally enforcing their order of fulfillment.

Declaration

class func wait(for expectations: [XCTestExpectation], enforceOrder enforceOrderOfFulfillment: Bool) -> XCTWaiter.Result

Parameters

  • expectations:

    An array of expectations the test must satisfy.

  • enforceOrderOfFulfillment:

    If True, the test must satisfy the expectations in the order they appear in the array.

Return Value

A value describing the outcome of waiting for expectations. The test discards the waiter when the wait completes.

Discussion

In Objective-C code, you might use an expectation to wait on a call to an interface that uses a completion handler to return a result. From Swift code, consider calling withCheckedContinuation(function:_:) to use Concurrency instead of an expectation to wait on the result of a completion handler.

See Also

Waiting for Expectations