Contents

template

The app entity describes a text document template.

Declaration

var template: some AssistantSchemas.Entity { get }

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.template schema:

@AppEntity(schema: .wordProcessor.template)
struct WordProcessorDocumentTemplateEntity: AppEntity {
    struct Query: EntityStringQuery {
        func entities(for identifiers: [WordProcessorDocumentTemplateEntity.ID]) async throws -> [WordProcessorDocumentTemplateEntity] { [] }
        func entities(matching string: String) async throws -> [WordProcessorDocumentTemplateEntity] { [] }
    }

    static var defaultQuery = Query()
    var displayRepresentation: DisplayRepresentation { "Text Document Template" }

    let id = UUID()

    @Property
    var name: String
}

See Also

Content and parameter types