App Intents and Shortcuts
Expose actions to Siri and Shortcuts.
What App Intents Are
The App Intents framework exposes your app's actions to the system — Siri, Shortcuts, Spotlight, widgets, and the Action button. You describe an action once as a Swift type, and it becomes available everywhere, voice-driven and automatable.
import AppIntents
// Define an action as a type; the system can run it
// from Siri, Shortcuts, Spotlight, widgets, etc.Defining an AppIntent
An intent conforms to AppIntent, declares a user-facing title, and implements perform() which does the work and returns a result. The framework discovers it automatically — no registration needed.
import AppIntents
struct AddTaskIntent: AppIntent {
static var title: LocalizedStringResource = "Add Task"
func perform() async throws -> some IntentResult {
// create the task here
return .result()
}
}All lessons in this course
- Building a WidgetKit Widget
- Timeline Providers and Snapshots
- App Extensions Overview
- App Intents and Shortcuts