<!--
{
  "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/AppEntityDefinition/expectIdentifier(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "App Intents Testing",
      "AppIntentsTesting"
    ],
    "preciseIdentifier" : "s:17AppIntentsTesting0A16EntityDefinitionV16expectIdentifieryAA0adG11ExpectationVSSF"
  },
  "title" : "expectIdentifier(_:)"
}
-->

# expectIdentifier(_:)

Creates an expectation that an app entity is the instance with the
specified identifier.

```
func expectIdentifier(_ identifier: String) -> AppEntityIdentifierExpectation
```

## Parameters

`identifier`

The identifier of the entity instance to expect.

## Return Value

An expectation that compares an entity’s identifier to
`identifier`.

## Discussion

Use the returned expectation for an intent parameter, an intent result,
or a property that holds an entity. Call
[`expect`](/documentation/AppIntentsTesting/AppEntityIdentifierExpectation/expect) on it to also check the
instance’s properties. For example:

```swift
let workCalendarExpectation = createEventIntentDefinition.expect(
    calendar: calendarEntityDefinition.expectIdentifier(
        "edea53fb-90b7-4481-afc7-d86e2dd0d27d"
    )
)
```

---

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)