---
title: PredicateExpectation
framework: appintentstesting
role: symbol
role_heading: Structure
platforms: [iOS 27.3+, iPadOS 27.3+, Mac Catalyst 27.3+, macOS 27.3+, tvOS 27.3+, visionOS 27.3+, watchOS 27.3+]
path: appintentstesting/predicateexpectation
---

# PredicateExpectation

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

## Declaration

```swift
struct PredicateExpectation
```

## Overview

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:) instead: 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](appintentstesting/intentvalueexpectation.md)
- [ResolvableIntentValueExpectation](appintentstesting/resolvableintentvalueexpectation.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
