Contents

ComputedProperty(customIndexingKey:)

A macro that creates a computed property for an AppEntity that allows for providing a get and/or set accessor

Declaration

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

Parameters

  • customIndexingKey:

    A custom Spotlight attribute set key for this property.

Example

struct Restaurant: AppEntity {
    var model: Menu

    @ComputedProperty(customIndexingKey: \.myCustomKey)
    var menuItems: [MenuItem] {
        model.menuItems
    }
}

See Also

Entity property macros