<!--
{
  "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/PrimitiveExpectation",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "App Intents Testing"
    ],
    "preciseIdentifier" : "s:17AppIntentsTesting20PrimitiveExpectationV"
  },
  "title" : "PrimitiveExpectation"
}
-->

# PrimitiveExpectation

A value expectation that checks whether a value is present or whether its
string content matches.

```
struct PrimitiveExpectation
```

## Overview

Use a primitive expectation to require that an intent parameter, app entity
property, or intent result has a value or has no value, or to check the
content of a string value. String comparisons are exact and case-sensitive.
A string expectation on a non-string value isn’t satisfied.

You don’t create a primitive expectation directly. Use
[`isNil`](/documentation/AppIntentsTesting/IntentValueExpectation/isNil), [`notNil`](/documentation/AppIntentsTesting/IntentValueExpectation/notNil),
[`contains(_:)`](/documentation/AppIntentsTesting/IntentValueExpectation/contains(_:)),
[`contains(regex:)`](/documentation/AppIntentsTesting/IntentValueExpectation/contains(regex:)), or
[`equals(_:)`](/documentation/AppIntentsTesting/IntentValueExpectation/equals(_:)) instead. Passing `nil` as an
`expect` argument is the same as leaving out its label: the expectation
doesn’t check the value.

The following example expects an event with a title that contains “NASA”,
a location, and no end date:

```swift
let createEventIntentDefinition = definitions.intents["CreateEventIntent"]
let expectation = createEventIntentDefinition.expect(
    title: .contains("NASA"),
    location: .notNil,
    endDate: .isNil
)
```

## Relationships

### Conforms To

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

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

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

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

---

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)