<!--
{
  "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/IntentValueExpectation/matches(_:requirement:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "App Intents Testing",
      "AppIntentsTesting"
    ],
    "preciseIdentifier" : "s:17AppIntentsTesting22IntentValueExpectationPA2A09PredicateF0VRszrlE7matches_11requirementAE10Foundation0G0Vyqd___QPG_SSSgt0aB11TypeSupport0dE11ConvertibleRd__lFZ"
  },
  "title" : "matches(_:requirement:)"
}
-->

# matches(_:requirement:)

Creates an expectation that requires the value to satisfy a predicate,
with an optional description of the check.

```
static func matches<Input>(_ predicate: Predicate<Input>, requirement: String? = nil) -> PredicateExpectation where Input : IntentValueConvertible
```

## Parameters

`predicate`

The predicate to evaluate against the value.

`requirement`

A readable description of the check. The default is
`nil`.

## Return Value

A predicate expectation that evaluates `predicate` against
the value.

## Discussion

Use this method for values that aren’t strings. A predicate on a
non-optional type isn’t satisfied when the value is missing, and a
predicate on an optional type receives `nil` and decides for itself. A
predicate whose input type doesn’t match the value’s type isn’t
satisfied.

---

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)