Contents

draft

The app entity describes an email draft.

Declaration

var draft: 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 .mail.draft schema:

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

    static var defaultQuery = Query()
    var displayRepresentation: DisplayRepresentation { "Mail Draft" }

    let id = UUID()

    @Property
    var to: [IntentPerson]

    @Property
    var cc: [IntentPerson]

    @Property
    var bcc: [IntentPerson]

    @Property
    var subject: String?

    @Property
    var body: AttributedString?

    @Property
    var attachments: [IntentFile]

    @Property
    var account: MailAccountEntity
}

For more information about the .mail app intent domain, see Making email actions available to Siri and Apple Intelligence. For general information about app intent domains, see Integrating actions with Siri and Apple Intelligence.

See Also

Content and parameter types