Contents

DeferredProperty(title: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(title: LocalizedStringResource, indexingKey: PartialKeyPath<CSSearchableItemAttributeSet>)

Parameters

  • title:

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

  • indexingKey:

    A Spotlight attribute set key mapping for this property.

Example

struct Restaurant: AppEntity {
    var model: Menu

    @DeferredProperty(title: "Popular Items", indexingKey: \.displayName)
    var popularItems: [MenuItem] {
        get async {
            await model.server.popularMenuItems()
        }
    }
}

See Also

Property declarations