<!--
{
  "availability" : [
    "iOS: 27.3.0 -",
    "iPadOS: 27.3.0 -",
    "macCatalyst: 27.3.0 -",
    "macOS: 27.3.0 -",
    "tvOS: 27.3.0 -",
    "visionOS: 27.3.0 -",
    "watchOS: 27.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppIntentsTesting",
  "identifier" : "/documentation/AppIntentsTesting/PredicateExpectation",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "App Intents Testing"
    ],
    "preciseIdentifier" : "s:17AppIntentsTesting20PredicateExpectationV"
  },
  "title" : "PredicateExpectation"
}
-->

# PredicateExpectation

A value expectation that checks a value of any convertible type against a
predicate.

```
struct PredicateExpectation
```

## Overview

Use a predicate expectation for values that aren’t strings, such as
numbers, dates, measurements, people, or arrays of these. The predicate’s
input can be any type that conforms to `IntentValueConvertible`. A
predicate whose input type doesn’t match the value’s type isn’t satisfied.

The predicate’s input type determines how a missing value is handled. A
predicate on a non-optional type, like `Predicate<Date>`, isn’t satisfied
when the value is missing. A predicate on an optional type, like
`Predicate<Date?>`, receives `nil` and decides for itself.

You don’t create a predicate expectation directly. Use
[`matches(_:requirement:)`](/documentation/AppIntentsTesting/IntentValueExpectation/matches(_:requirement:)) instead:

```swift
let createEventIntentDefinition = definitions.intents["CreateEventIntent"]
let expectation = createEventIntentDefinition.expect(
    attendeeCount: .matches(#Predicate<Int> { $0 >= 3 }),
    endDate: .matches(#Predicate<Date?> { $0 == nil || $0! > deadline })
)
```

## Relationships

### Conforms To

[`IntentValueExpectation`](/documentation/AppIntentsTesting/IntentValueExpectation)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`ResolvableIntentValueExpectation`](/documentation/AppIntentsTesting/ResolvableIntentValueExpectation)

[`Sendable`](/documentation/Swift/Sendable)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)