Contents

message

The app entity describes an email message.

Declaration

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

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

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

    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 sender: IntentPerson

    @Property
    var dateSent: Date

    @Property
    var dateReceived: Date

    @Property
    var isRead: Bool

    @Property
    var isJunk: Bool

    @Property
    var isFlagged: Bool

    @Property
    var account: MailAccountEntity

    @Property
    var mailbox: MailboxEntity
}

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