duo-app-intents
App Intents on iPhone Duo: AppIntent, AppEntity with EntityStringQuery, OpenIntent with TargetContentProvidingIntent and onAppIntentExecution (UISceneAppIntent and AppIntentSceneDelegate in UIKit) to show the right item in the right pane or window, handlesExternalEvents to pick the window, intents that work with the phone closed (supportedModes .background, IntentDialog, ProvidesDialog, isVoiceOnly), onscreen awareness when two panes are visible (appEntityIdentifier, appEntityIdentifier(forSelectionType:), NSUserActivity), App Shortcuts (AppShortcutsProvider) and AppIntentsTesting runs on the Duo simulator in each pose. Use when an app adds Siri, Shortcuts, Spotlight or Apple Intelligence actions, when an intent opens the wrong pane or an extra window, or when an intent must work while the phone is closed.
Kimeur · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add Kimeur/duology --skill duo-app-intents技能说明
name: duo-app-intents description: "App Intents on iPhone Duo: AppIntent, AppEntity with EntityStringQuery, OpenIntent with TargetContentProvidingIntent and onAppIntentExecution (UISceneAppIntent and AppIntentSceneDelegate in UIKit) to show the right item in the right pane or window, handlesExternalEvents to pick the window, intents that work with the phone closed (supportedModes .background, IntentDialog, ProvidesDialog, isVoiceOnly), onscreen awareness when two panes are visible (appEntityIdentifier, appEntityIdentifier(forSelectionType:), NSUserActivity), App Shortcuts (AppShortcutsProvider) and AppIntentsTesting runs on the Duo simulator in each pose. Use when an app adds Siri, Shortcuts, Spotlight or Apple Intelligence actions, when an intent opens the wrong pane or an extra window, or when an intent must work while the phone is closed." metadata: verified: "Xcode 27.1 (27A9275), iOS 27.1 simulator, device: no" sources: "https://github.com/Kimeur/duology/blob/main/reference/sources.md"
duo-app-intents
App Intents describe your app's actions and content to Siri, Shortcuts, Spotlight, widgets and Apple Intelligence (App Intents). On iPhone Duo an intent can arrive while the phone is closed, while two panes are on screen, or while two windows of your app share the inner display. This skill makes each intent land in the right place.
Load neighbours when the task needs them: duo-scenes (windows, Split View, the scene manifest), duo-continuity (window models that survive a fold), duo-intelligence (the summaries an intent can return), duo-system-surfaces (widgets and controls that run intents).
Labels: measured means we ran it on the iPhone Duo simulator (iOS 27.1) on 20 October 2026, with AppIntentsTesting driving the intents; see references/evidence.md. Unverified means we could not confirm it. Everything else comes from Apple's pages, linked inline. Full source list: reference/sources.md.
What Apple says, and what it doesn't
Apple's iPhone Duo pages and the six Duo Tech Talks don't mention App Intents. The Duo rules below join Apple's App Intents guides (Directing app intents to your app's scenes, Configuring the runtime behavior, Providing contextual cues) with Apple's Duo scene rules and our measurements.
| Situation on iPhone Duo | What happened | Source |
|---|---|---|
OpenIntent with the phone closed | onAppIntentExecution ran 0.9 to 1.7 s before perform(); the collapsed split view showed the note | measured |
| The same with the phone open | The list and the note side by side, the row still visible | measured |
A .background intent with the app behind another app | perform() ran in the background mode; the scene stayed in the background | measured, closed and open |
An OpenIntent with the app behind | The handler ran while the scene was still inactive, then the same window became active with the note; no new window | measured, closed and open |
| Notes on screen for Siri | Closed: 1 (the open note). Open: 4 (three rows and the open note) | measured |
| Two windows on the inner display | The system routes by contentIdentifier to the window that prefers it | Apple's routing guide; unverified on Duo |
Rules
- An intent changes a window's model, never a view. The model survives the fold; views get rebuilt (
duo-continuity). - Take the item as a parameter. Open, two notes can be on screen at once, in two panes or two windows. Never read "the selected note" inside
perform(). - Open content with
OpenIntentplusTargetContentProvidingIntent, and set the selection inonAppIntentExecution. The split view then does the right thing on each display. - Route to an existing window; don't open a new one. Prefer the window that already shows the item with
handlesExternalEvents(preferring:allowing:). New windows work only on the inner display (duo-scenes). - Default to the background. An intent that answers in words works closed, open and in a pocket. Ask for the foreground only when the person must see something.
- Annotate each pane. The list with
appEntityIdentifier(forSelectionType:identifier:), the open item withappEntityIdentifier(_:)or anNSUserActivity. - Turn on multiple scenes. Apple's routing needs
UIApplicationSupportsMultipleScenesset toYES, even with one scene (routing guide). - Test each intent closed and open with AppIntentsTesting, then try it with Siri on a device.
- Gate below iOS 26.
TargetContentProvidingIntent,onAppIntentExecutionandsupportedModesare iOS 26; the view annotations are iOS 18.4. iPhone Duo runs iOS 27.1, so this only matters for other iPhones: add the conformance in an@available(iOS 26.0, *)extension, marksupportedModes@available(iOS 26.0, *), and wrap the modifiers inif #available.
1. An entity and its query
import AppIntents
import Observation
struct Note: Identifiable, Hashable, Sendable {
let id: UUID
var title: String
var body: String
}
/// One store for the whole app, shared by every window and by the intents.
@MainActor @Observable
final class NoteLibrary {
static let shared = NoteLibrary()
var notes: [Note] = []
func note(_ id: Note.ID?) -> Note? { notes.first { $0.id == id } }
}
struct NoteEntity: AppEntity {
static let typeDisplayRepresentation: TypeDisplayRepresentation = "Note"
sta
阅读完整来源 ↗