<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreSpotlight",
  "identifier" : "/documentation/CoreSpotlight/CSSearchableItemAttributeSet/associateAppEntity(_:priority:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Spotlight",
      "CoreSpotlight"
    ],
    "preciseIdentifier" : "s:So28CSSearchableItemAttributeSetC10AppIntentsE09associateE6Entity_8priorityyx_SitAC07IndexedH0RzlF"
  },
  "title" : "associateAppEntity(_:priority:)"
}
-->

# associateAppEntity(_:priority:)

Associates the specified app entity with this attribute set.

```
func associateAppEntity<Entity>(_ appEntity: Entity, priority: Int = 0) where Entity : IndexedEntity
```

## Parameters

`appEntity`

The entity to associate with the attributes. Choose the entity with the
same data as the [`CSSearchableItem`](/documentation/CoreSpotlight/CSSearchableItem) that you’re creating.

`priority`

The importance of this item compared to other donated items. Give more important
items a higher priority value. The App Intents system uses priorities to determine what
items to show in suggestions and other places.

## Discussion

If your app has an <doc://com.apple.documentation/documentation/AppIntents/AppEntity> object that
equates to the [`CSSearchableItem`](/documentation/CoreSpotlight/CSSearchableItem) you’re creating, use this method to connect the two objects.
When your searchable item appears in search results, Spotlight can use the provided entity to
perform related actions. For example, it can ask your app to open the entity and display its
content.

For additional information about the relationship between searchable items and entities, see
<doc://com.apple.documentation/documentation/AppIntents/making-app-entities-available-in-spotlight>.

---

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)