swift · note · architecture · environment
App Intents and Siri Boundaries
Context
App Intents work best when they delegate to a feature boundary instead of reimplementing feature logic inside the intent itself. That keeps Siri actions, shortcuts, and app screens aligned.
The snippet
struct ToggleFocusModeIntent: AppIntent {
static var title: LocalizedStringResource = "Toggle Focus Mode"
func perform() async throws -> some IntentResult {
// Call into a feature service or app boundary here.
return .result()
}
}
Why this works
The intent stays small and predictable. The app boundary owns the real behavior, which means the same logic can be reused by buttons, shortcuts, and automation.
Use it when:
- the action belongs to an existing feature
- you want Siri and the app UI to behave the same way
- the intent needs injected configuration or services
Avoid it when:
- you would duplicate feature logic in the intent
- the intent becomes a second copy of the app architecture
- the boundary is so thin that it adds more maintenance than value
Takeaway: App Intents should route behavior, not recreate it.