DeferredProperty(indexingKey:)
A macro that adds an asynchronous app entity property with an asynchronous get accessor.
Declaration
@attached(peer, names: prefixed(`$`), prefixed(`_`)) @attached(accessor, names: named(get), named(set)) macro DeferredProperty(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
@DeferredProperty(indexingKey: \.displayName)
var popularItems: [MenuItem] {
get async {
await model.server.popularMenuItems()
}
}
}See Also
Property declarations
ComputedProperty()ComputedProperty(title:)ComputedProperty(indexingKey:)ComputedProperty(customIndexingKey:)ComputedProperty(title:customIndexingKey:)ComputedProperty(title:indexingKey:)DeferredProperty()DeferredProperty(title:)DeferredProperty(title:indexingKey:)EntityPropertyEntityPropertyModifiersProperty comparators