document
The app entity describes a text document.
Declaration
var document: some AssistantSchemas.Entity { get }Mentioned in
Overview
Use Swift macros that generate additional properties and add protocol conformance for your app entity implementation.The following example shows an app entity that conforms to the .wordProcessor.document schema:
@AppEntity(schema: .wordProcessor.document)
struct WordProcessorDocumentEntity: AppEntity {
struct Query: EntityStringQuery {
func entities(for identifiers: [WordProcessorDocumentEntity.ID]) async throws -> [WordProcessorDocumentEntity] { [] }
func entities(matching string: String) async throws -> [WordProcessorDocumentEntity] { [] }
}
static var defaultQuery = Query()
var displayRepresentation: DisplayRepresentation { "Text Document" }
let id = UUID()
@Property
var name: String
@Property
var creationDate: Date?
@Property
var modificationDate: Date?
}