ComputedProperty(indexingKey:)
A macro that adds a computed app entity property with get and set accessors.
Declaration
@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 to a Spotlight index.
The system doesn’t send it to Shortcuts or Siri automatically; it fetches the value only when needed.
Example
struct Restaurant: AppEntity {
var model: Menu
@ComputedProperty(indexingKey: \.displayName)
var menuItems: [MenuItem] {
model.menuItems
}
}See Also
Property declarations
ComputedProperty()ComputedProperty(title:)ComputedProperty(customIndexingKey:)ComputedProperty(title:customIndexingKey:)ComputedProperty(title:indexingKey:)DeferredProperty()DeferredProperty(title:)DeferredProperty(indexingKey:)DeferredProperty(title:indexingKey:)EntityPropertyEntityPropertyModifiersProperty comparators