createDraft
The app intent conforms to the schema for creating an email draft.
Declaration
var createDraft: some AssistantSchemas.Intent { get }Overview
Use Swift macros that generate additional properties and add protocol conformance for your app intent implementation. The following example shows an app intent that conforms to the .mail.createDraft schema:
@AppIntent(schema: .mail.createDraft)
struct CreateDraftIntent: AppIntent {
@Parameter
var to: [IntentPerson]
@Parameter
var cc: [IntentPerson]
@Parameter
var bcc: [IntentPerson]
@Parameter
var subject: String?
@Parameter
var body: AttributedString?
@Parameter
var account: MailAccountEntity?
@Parameter(default: [])
var attachments: [IntentFile]
func perform() async throws -> some ReturnsValue<MailDraftEntity> {
.result(value: MailDraftEntity())
}
}For more information about the .mail app intent domain, see doc:Making-email-actions-available-to-siri-and-apple-intelligence. For general information about app intent domains, see doc:Integrating-actions-with-siri-and-apple-intelligence.