---
title: "wait(for:)"
framework: xctest
role: symbol
role_heading: Type Method
path: "xctest/xctwaiter/wait(for:)-swift.type.method"
---

# wait(for:)

Creates a waiter that waits on a group of expectations.

## Declaration

```swift
class func wait(for expectations: [XCTestExpectation]) -> XCTWaiter.Result
```

## Parameters

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

## Return Value

Return Value A value describing the outcome of waiting for expectations.

## Discussion

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. In Swift, consider calling withCheckedContinuation(function:_:) to use Concurrency instead of an expectation to wait on the result.

## See Also

### Waiting for Expectations

- [fulfillment(of:timeout:enforceOrder:)](xctest/xctwaiter/fulfillment(of:timeout:enforceorder:)-swift.method.md)
- [wait(for:)](xctest/xctwaiter/wait(for:)-swift.method.md)
- [wait(for:enforceOrder:)](xctest/xctwaiter/wait(for:enforceorder:)-swift.method.md)
- [wait(for:timeout:)](xctest/xctwaiter/wait(for:timeout:)-swift.method.md)
- [wait(for:timeout:enforceOrder:)](xctest/xctwaiter/wait(for:timeout:enforceorder:)-swift.method.md)
- [fulfillment(of:timeout:enforceOrder:)](xctest/xctwaiter/fulfillment(of:timeout:enforceorder:)-swift.type.method.md)
- [wait(for:enforceOrder:)](xctest/xctwaiter/wait(for:enforceorder:)-swift.type.method.md)
- [wait(for:timeout:)](xctest/xctwaiter/wait(for:timeout:)-swift.type.method.md)
- [wait(for:timeout:enforceOrder:)](xctest/xctwaiter/wait(for:timeout:enforceorder:)-swift.type.method.md)
- [XCTWaiter.Result](xctest/xctwaiter/result.md)
