---
title: "wait(for:)"
framework: xctest
role: symbol
role_heading: Instance Method
path: "xctest/xctestcase/wait(for:)"
---

# wait(for:)

Waits on a group of expectations.

## Declaration

```swift
func wait(for expectations: [XCTestExpectation])
```

## Parameters

- `expectations`: An array of expectations the test must satisfy.

## Discussion

Discussion note: Use fulfillment(of:timeout:enforceOrder:) in Swift code requiring concurrency. 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

- [fulfillment(of:timeout:enforceOrder:)](xctest/xctestcase/fulfillment(of:timeout:enforceorder:).md)
- [wait(for:enforceOrder:)](xctest/xctestcase/wait(for:enforceorder:).md)
- [wait(for:timeout:)](xctest/xctestcase/wait(for:timeout:).md)
- [wait(for:timeout:enforceOrder:)](xctest/xctestcase/wait(for:timeout:enforceorder:).md)
- [waitForExpectations(timeout:handler:)](xctest/xctestcase/waitforexpectations(timeout:handler:).md)
- [XCWaitCompletionHandler](xctest/xcwaitcompletionhandler.md)
- [XCTestError](xctest/xctesterror.md)
- [XCTestError.Code](xctest/xctesterror/code.md)
- [XCTestErrorDomain](xctest/xctesterrordomain.md)
