---
title: XCTNSPredicateExpectation
framework: xctest
role: symbol
role_heading: Class
path: xctest/xctnspredicateexpectation
---

# XCTNSPredicateExpectation

An expectation that’s fulfilled when an NSPredicate is satisfied.

## Declaration

```swift
class XCTNSPredicateExpectation
```

## Overview

Overview When you use an instance of this class from Swift and await using fulfillment(of:timeout:enforceOrder:) rather than wait(for:), XCTest evaluates the associated predicate on the main actor.

## Topics

### Creating a Predicate-Based Expectation

- [init(predicate:object:)](xctest/xctnspredicateexpectation/init(predicate:object:).md)

### Expectation Properties

- [predicate](xctest/xctnspredicateexpectation/predicate.md)
- [object](xctest/xctnspredicateexpectation/object.md)

### Handling Predicate Resolution

- [handler](xctest/xctnspredicateexpectation/handler-swift.property.md)
- [XCTNSPredicateExpectation.Handler](xctest/xctnspredicateexpectation/handler-swift.typealias.md)

## Relationships

### Inherits From

- [XCTestExpectation](xctest/xctestexpectation.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)
