AnyAppIntent
A type-erased, intermediate representation of an app intent for testing purposes.
Declaration
@dynamicMemberLookup struct AnyAppIntentOverview
The AnyAppIntent structure resolves to your actual app intent type and gives you access to its parameters and results at runtime, enabling you to test your app intent code as shown in the following example:
// Getting an intent definition and creating an instance.
let definitions = IntentDefinitions(
bundleIdentifier: "com.example.app"
)
var intent = definitions.intents["CreateNote"]
.makeIntent()
// Setting any intent parameters.
intent.title = "Meeting Notes"
intent.priority = 5
intent.isUrgent = true
// Reading parameters, when needed.
let title: String? = try intent.title
// Performing the intent.
let result = try await intent.run()
// Adding your verification code.
// ...