<!--
{
  "availability" : [
    "iOS: 18.4.0 -",
    "iPadOS: 18.4.0 -",
    "macOS: 15.4.0 -",
    "tvOS: 18.4.0 -",
    "visionOS: 2.4.0 -",
    "watchOS: 11.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/appEntityIdentifier(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP012_AppIntents_aB0E19appEntityIdentifieryQr0dE00gH0VSgF"
  },
  "title" : "appEntityIdentifier(_:)"
}
-->

# appEntityIdentifier(_:)

Associates a SwiftUI view with an app entity to make its content discoverable by Apple Intelligence and Siri.

```
nonisolated func appEntityIdentifier(_ identifier: EntityIdentifier?) -> some View
```

## Parameters

`identifier`

The fully qualified identifier of the app entity instance you associate with the view.

## Discussion

Use this modifier to make your app entity discoverable by Apple Intelligence and Siri and provide additional context to the system
when the view appears onscreen. You can associate the view with one app entity. If you apply the modifier several times on one
view, the system gives precedence to the innermost modifier and discards the other modifiers.

For example, this example associates `entityA` with the `Rectangle()` and `entityB` with `BarView`. The system ignores the modifier
that associates `entityC` with the `BarView`:

```swift
struct FooView {
    let entityA: EntityA
    let entityB: EntityB
    let entityC: EntityC
    var body: some View {
        BarView {
            Rectangle()
                .appEntityIdentifier(EntityIdentifier(for: EntityA.self, identifier: entityA.id))
        }
        .appEntityIdentifier(EntityIdentifier(for: EntityB.self, identifier: entityB.id))
        .appEntityIdentifier(EntityIdentifier(for: EntityC.self, identifier: entityC.id))
    }
}
```

To remove the association, set `appEntityIdentifier` to `nil`.

For more information, refer to <doc:providing-contextual-cues-to-Apple-Intelligence-and-Siri> and
<doc://com.apple.documentation/documentation/AppIntents>.

---

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)