<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppIntents",
  "identifier" : "/documentation/AppIntents/ComputedProperty(indexingKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Macro",
  "symbol" : {
    "kind" : "Macro",
    "modules" : [
      "App Intents"
    ],
    "preciseIdentifier" : "s:10AppIntents16ComputedProperty11indexingKeyys07PartialF4PathCySo28CSSearchableItemAttributeSetCG_tcfm"
  },
  "title" : "ComputedProperty(indexingKey:)"
}
-->

# ComputedProperty(indexingKey:)

A macro that adds a computed app entity property with get and set accessors.

```
@attached(peer, names: prefixed(`$`), prefixed(`_`)) @attached(accessor, names: named(get), named(set)) macro ComputedProperty(indexingKey: PartialKeyPath<CSSearchableItemAttributeSet>)
```

## Parameters

`indexingKey`

A Spotlight attribute set key mapping for this property.

## Overview

A deferred property has a few trade-offs:

- The system doesn’t index it when you donate an [`IndexedEntity`](/documentation/AppIntents/IndexedEntity) to a Spotlight index.
- The system doesn’t send it to Shortcuts or Siri automatically; it fetches the value only when needed.

## Example

```swift
struct Restaurant: AppEntity {
    var model: Menu

    @ComputedProperty(indexingKey: \.displayName)
    var menuItems: [MenuItem] {
        model.menuItems
    }
}
```

---

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)