---
title: "init(predicate:object:)"
framework: xctest
role: symbol
role_heading: Initializer
path: "xctest/xctnspredicateexpectation/init(predicate:object:)"
---

# init(predicate:object:)

Creates an expectation that’s fulfilled when an NSPredicate instance returns true, optionally for a provided object.

## Declaration

```swift
init(predicate: NSPredicate, object: Any?)
```

## Parameters

- `predicate`: The predicate to evaluate.
- `object`: An optional object XCTest evaluates the predicate against.

## Discussion

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