0Pricing
Swift Academy · Lesson

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

  1. Building a WidgetKit Widget
  2. Timeline Providers and Snapshots
  3. App Extensions Overview
  4. App Intents and Shortcuts
← Back to Swift Academy