<!--
{
  "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(title:customIndexingKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Macro",
  "symbol" : {
    "kind" : "Macro",
    "modules" : [
      "App Intents"
    ],
    "preciseIdentifier" : "s:10AppIntents16ComputedProperty5title17customIndexingKeyy10Foundation23LocalizedStringResourceV_So017CSCustomAttributeH0Ctcfm"
  },
  "title" : "ComputedProperty(title:customIndexingKey:)"
}
-->

# ComputedProperty(title:customIndexingKey:)

A macro that adds a computed app entity property with a get accessor and an optional set accessor.

```
@attached(peer, names: prefixed(`$`), prefixed(`_`)) @attached(accessor, names: named(get), named(set)) macro ComputedProperty(title: LocalizedStringResource, customIndexingKey: CSCustomAttributeKey)
```

## Parameters

`title`

A localized string resource describing the property for display in the user interface.

`customIndexingKey`

A custom Spotlight attribute set key for this property.

## Example

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

    @ComputedProperty(title: "Menu Items", customIndexingKey: \.myCustomKey)
    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)