Post

Replies

Boosts

Views

Activity

Reply to Guidance Implementing IndexedEntity and CSSearchableItemAttributeSet
After spending some time talking with DTS and reviewing the updated App Intent sample code located here https://developer.apple.com/documentation/appintents/acceleratingappinteractionswithappintents, I've got my answer. The sample provides one way to integrate Spotlight, by indexing a separate model and associating the app entity. What I discovered was that if you want to implement IndexedEntity, you can indeed provide an extended attribute set, you just need to start with the existing one, not create your own. Pretty simple: extension HotelEntity: IndexedEntity { var attributeSet: CSSearchableItemAttributeSet { let existingAttributes = defaultAttributeSet // this is the key existingAttributes.displayName = "\(name) displayName" existingAttributes.title = "\(name) title" existingAttributes.domainIdentifier = "\(name) domainIdentifier" existingAttributes.identifier = "\(name) identifier" existingAttributes.contentDescription = "\(name) contentDescription" existingAttributes.namedLocation = "\(name) namedLocation" return existingAttributes } } With that, it's all working!
Nov ’24