ComputedProperty(title: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(title: LocalizedStringResource, customIndexingKey: CSCustomAttributeKey)Example
struct Restaurant: AppEntity {
var model: Menu
@ComputedProperty(title: "Menu Items", customIndexingKey: \.myCustomKey)
var menuItems: [MenuItem] {
model.menuItems
}
}Parameter:
title: A localized string resource describing the property for display in the user interface.
customIndexingKey: A custom Spotlight attribute set key for this property.