---
title: XCTWaiter
framework: xctest
role: symbol
role_heading: Class
path: xctest/xctwaiter
---

# XCTWaiter

Waits for the fulfillment of a group of expectations.

## Declaration

```swift
class XCTWaiter
```

## Overview

Overview You can use waiters with or without a delegate to respond to events such as completion, timeout, or invalid expectation fulfillment. XCTestCase automatically conforms to the XCTWaiterDelegate protocol and automatically reports timeouts and other unexpected events as test failures. You can use waiters without a delegate or any association with a test case instance. This allows test support libraries to provide convenience methods for waiting without having to pass test cases through those APIs.

## Topics

### Creating a Waiter

- [init(delegate:)](xctest/xctwaiter/init(delegate:).md)

### 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:)](xctest/xctwaiter/wait(for:)-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)

### Responding to Expectation Fulfilment

- [delegate](xctest/xctwaiter/delegate.md)
- [XCTWaiterDelegate](xctest/xctwaiterdelegate.md)
- [fulfilledExpectations](xctest/xctwaiter/fulfilledexpectations.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
