app-intents
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWrite and review Swift code that exposes app functionality through the App Intents framework, ensuring correct protocol conformance, safe data flow, and idiomatic discoverability wiring.
Review process:
- Check intent fundamentals (protocol, , return types, dialog) using
perform().references/fundamentals.md - Validate parameters and parameter options using .
references/parameters.md - Validate entity types, display representations, and queries using .
references/entities.md - Check the registration and discoverability UI using
AppShortcutsProvider.references/shortcuts-and-siri.md - Validate navigation and snippet view return types using
OpenIntent.references/open-and-snippet-intents.md - Check dependency injection and the data-controller pattern using .
references/dependencies.md - Validate Spotlight indexing via and attribute sets using
IndexedEntity.references/spotlight.md - Check /
@AssistantEntityschema adoption using@AssistantIntent.references/assistant-schemas.md - If writing or reviewing tests for intents, use .
references/testing-intents.md - Catch common mistakes using .
references/anti-patterns.md
If doing partial work, load only the relevant reference files.
编写并审查通过App Intents框架暴露应用功能的Swift代码,确保协议合规、数据流安全,以及符合规范的可发现性配置。
审查流程:
- 参考检查意图基础内容(协议、
references/fundamentals.md、返回类型、对话)。perform() - 参考验证参数及参数选项。
references/parameters.md - 参考验证实体类型、展示形式及查询逻辑。
references/entities.md - 参考检查
references/shortcuts-and-siri.md注册及可发现性UI。AppShortcutsProvider - 参考验证
references/open-and-snippet-intents.md导航及代码片段视图返回类型。OpenIntent - 参考检查依赖注入及数据控制器模式。
references/dependencies.md - 参考验证通过
references/spotlight.md及属性集实现的Spotlight索引。IndexedEntity - 参考检查
references/assistant-schemas.md/@AssistantEntity模式的适配情况。@AssistantIntent - 若编写或审查意图测试代码,参考。
references/testing-intents.md - 参考排查常见错误。
references/anti-patterns.md
若仅处理部分工作,只需加载相关参考文件。
Task-based routing
基于任务的路由
Match the user's goal to the read order. Load only what you need.
根据用户目标匹配阅读顺序,仅加载所需内容。
"Create my first App Intent"
"创建我的第一个App Intent"
- - protocol,
references/fundamentals.md, return typesperform() - - register it so it shows up
references/shortcuts-and-siri.md
- - 协议、
references/fundamentals.md、返回类型perform() - - 注册以使其可见
references/shortcuts-and-siri.md
"Add a parameter the user picks in Shortcuts"
"添加可在Shortcuts中选择的参数"
- -
references/parameters.md, prompts, disambiguation@Parameter - - if the parameter is a domain entity
references/entities.md
- -
references/parameters.md、提示、消歧义@Parameter - - 若参数为领域实体
references/entities.md
"Make my app's data searchable from Siri / Spotlight"
"让我的应用数据可被Siri / Spotlight搜索"
- -
references/entities.md,AppEntity,IndexedEntity@Property - - indexing strategies, attribute sets
references/spotlight.md - - flexible matching, phrase rules
references/shortcuts-and-siri.md
- -
references/entities.md、AppEntity、IndexedEntity@Property - - 索引策略、属性集
references/spotlight.md - - 灵活匹配、短语规则
references/shortcuts-and-siri.md
"Show a summary / interactive view when Siri runs my intent"
"当Siri运行我的意图时展示摘要/交互式视图"
- - inline vs indirect snippets,
references/open-and-snippet-intents.md,SnippetIntentButton(intent:) - - return types and snippet design rules
references/fundamentals.md
- - 内联与间接代码片段、
references/open-and-snippet-intents.md、SnippetIntentButton(intent:) - - 返回类型及代码片段设计规则
references/fundamentals.md
"Open a specific thing in my app from Siri / Shortcuts"
"从Siri / Shortcuts打开应用中的特定内容"
- -
references/open-and-snippet-intents.md,OpenIntent,URLRepresentableIntentTargetContentProvidingIntent - - navigator / scene routing
references/dependencies.md
- -
references/open-and-snippet-intents.md、OpenIntent、URLRepresentableIntentTargetContentProvidingIntent - - 导航器/场景路由
references/dependencies.md
"Integrate with Apple Intelligence"
"与Apple Intelligence集成"
- - schema macros, domains, Use Model action, onscreen content
references/assistant-schemas.md - -
references/entities.md,@Property(required for several schemas)Transferable
- - 模式宏、领域、Use Model操作、屏幕内容
references/assistant-schemas.md - -
references/entities.md、@Property(部分模式必填)Transferable
"Support Visual Intelligence / image search"
"支持Visual Intelligence / 图片搜索"
- -
references/assistant-schemas.md,IntentValueQuery,SemanticContentDescriptor@UnionValue - -
references/entities.md+TransferablepairingOpenIntent
- -
references/assistant-schemas.md、IntentValueQuery、SemanticContentDescriptor@UnionValue - -
references/entities.md+Transferable配对OpenIntent
"Build an interactive widget or Control Center control"
"构建交互式小组件或控制中心控件"
- -
references/open-and-snippet-intents.md,Button(intent:),WidgetConfigurationIntent,ControlConfigurationIntentControlWidgetButton - - App Group shared storage, process boundaries
references/dependencies.md
- -
references/open-and-snippet-intents.md,Button(intent:),WidgetConfigurationIntent,ControlConfigurationIntentControlWidgetButton - - App Group共享存储、进程边界
references/dependencies.md
"Structure my app around App Intents"
"围绕App Intents构建应用架构"
- - intents as canonical action layer
references/fundamentals.md - -
references/dependencies.md, cross-module@DependencyAppIntentsPackage - - entity-as-bridge pattern
references/entities.md
- - 将意图作为标准操作层
references/fundamentals.md - -
references/dependencies.md、跨模块@DependencyAppIntentsPackage - - 实体桥接模式
references/entities.md
"Test my App Intents"
"测试我的App Intents"
- - unit tests, mocking
references/testing-intents.md, what you can't test@Dependency
- - 单元测试、模拟
references/testing-intents.md、不可测试内容@Dependency
"I'm hitting build errors or runtime bugs"
"遇到编译错误或运行时Bug"
- - 35+ catches with before/after fixes
references/anti-patterns.md
- - 35+种错误案例及修复前后对比
references/anti-patterns.md
Decision trees
决策树
Quick orientation when you know the task but not the right API.
当明确任务但不确定正确API时的快速指引。
Which intent protocol should I conform to?
应遵循哪种意图协议?
Generic action?
→ AppIntent
Opens the app to a specific entity?
→ OpenIntent (+ TargetContentProvidingIntent on iOS)
Renders an interactive view only, no business logic?
→ SnippetIntent
Needs to bring the app forward conditionally?
→ AppIntent with supportedModes (iOS 26+)
→ or ForegroundContinuableIntent (iOS 17-18)
Deletes entities with standard confirmation?
→ DeleteIntent
Routes a search query into the app?
→ ShowInAppSearchResultsIntent
Backs widget configuration?
→ WidgetConfigurationIntent (empty conformance, no perform)
Backs a Control Center control?
→ ControlConfigurationIntent
Has a universal-link URL representation?
→ URLRepresentableIntent + OpenIntent (no perform needed)
Matches an Apple Intelligence domain?
→ AppIntent + @AppIntent(schema: .domain.action)通用操作?
→ AppIntent
打开应用到特定实体?
→ OpenIntent (+ iOS端的TargetContentProvidingIntent)
仅渲染交互式视图,无业务逻辑?
→ SnippetIntent
需要有条件地将应用前置?
→ AppIntent搭配supportedModes(iOS 26+)
→ 或ForegroundContinuableIntent(iOS 17-18)
通过标准确认删除实体?
→ DeleteIntent
将搜索查询路由到应用内?
→ ShowInAppSearchResultsIntent
为小组件配置提供支持?
→ WidgetConfigurationIntent(空协议实现,无需perform)
为控制中心控件提供支持?
→ ControlConfigurationIntent
具有通用链接URL表示?
→ URLRepresentableIntent + OpenIntent(无需perform)
匹配Apple Intelligence领域?
→ AppIntent + @AppIntent(schema: .domain.action)Which entity type should I use?
应使用哪种实体类型?
Fixed set known at compile time?
→ AppEnum
Dynamic data with a persistent id?
→ AppEntity
Entity must appear in Spotlight?
→ AppEntity + IndexedEntity
Entity IS a file (scan, voice memo, exported image)?
→ FileEntity
Computed / aggregated data with no stable id?
→ TransientAppEntity
Needs Apple Intelligence schema awareness?
→ AppEntity + @AppEntity(schema: .domain.type)
Supports cross-app sharing?
→ AppEntity + Transferable编译时已知的固定集合?
→ AppEnum
带持久化ID的动态数据?
→ AppEntity
实体需出现在Spotlight中?
→ AppEntity + IndexedEntity
实体是文件(扫描件、语音备忘录、导出图片)?
→ FileEntity
无稳定ID的计算/聚合数据?
→ TransientAppEntity
需要Apple Intelligence模式感知?
→ AppEntity + @AppEntity(schema: .domain.type)
支持跨应用共享?
→ AppEntity + TransferableWhich query should my entity use?
实体应使用哪种查询?
Small fixed set, enumerable?
→ EnumerableEntityQuery (also gets a basic Find intent)
Large dataset, searchable by name?
→ EntityQuery + EntityStringQuery
Many queryable properties, user should build predicates?
→ EntityPropertyQuery (auto-generates Find intent with comparators + sort)
Simple id-only lookup, no search?
→ UniqueIDEntityQuery
Visual intelligence / image search?
→ IntentValueQuery + SemanticContentDescriptor小型固定集合,可枚举?
→ EnumerableEntityQuery(同时会生成基础Find意图)
大型数据集,可按名称搜索?
→ EntityQuery + EntityStringQuery
多个可查询属性,用户需构建谓词?
→ EntityPropertyQuery(自动生成带比较器+排序的Find意图)
仅按ID查找,无需搜索?
→ UniqueIDEntityQuery
视觉智能/图片搜索?
→ IntentValueQuery + SemanticContentDescriptorWhich property wrapper should I use on entity fields?
实体字段应使用哪种属性包装器?
Stored on the entity struct, should appear in Shortcuts/Find/summary?
→ @Property
Derived from an underlying model object (cheap to compute)?
→ @ComputedProperty (preferred over @Property for wrappers around models)
Derived AND should be indexed in Spotlight?
→ @ComputedProperty(indexingKey: \.keyName)
Expensive to compute (network, ML inference, heavy query)?
→ @DeferredProperty (async getter, only runs when system asks)
Internal to the entity, not shown anywhere?
→ plain stored property (no wrapper)存储在实体结构体中,需在Shortcuts/Find/摘要中显示?
→ @Property
从底层模型对象派生(计算成本低)?
→ @ComputedProperty(优先于@Property用于模型包装器)
派生且需在Spotlight中索引?
→ @ComputedProperty(indexingKey: \.keyName)
计算成本高(网络、ML推理、复杂查询)?
→ @DeferredProperty(异步获取器,仅在系统请求时运行)
实体内部使用,不对外展示?
→ 普通存储属性(无需包装器)Core Instructions
核心说明
- Target iOS 16+ / macOS 13+ minimum for App Intents. ,
IndexedEntity, focus filters, and control widgets require iOS 16+;OpenIntent/@AssistantEntityschemas require iOS 18.2+; anchored relative date styles and many assistant schemas require iOS 18.4+.@AssistantIntent - Never make a SwiftData class or other reference-type data model conform to
@Model.AppEntityrequiresAppEntity;Sendableclasses are not sendable. Create a separate@Modelentity that shadows the fields you want to expose.struct - Never pass across actor boundaries.
ModelContextis not sendable. PassModelContext(which is sendable) and create a local context inside the actor that needs one.ModelContainer - Never expose an intent to Siri/Spotlight only by writing its type, always register it through an . Types not registered there will not appear in Shortcuts, Siri suggestions, or the action button picker.
AppShortcutsProvider - Never write a Siri activation phrase without interpolating . The App Intents macro rejects phrases without it at compile time, because phrases without the app name would collide with other apps' commands.
\(.applicationName) - Never reach back into a SwiftUI from inside an intent.
@Queryonly works inside a@Query. Run a one-shotViewthrough aFetchDescriptorinstead, or route through a centralized data controller.ModelContext - Never instantiate services, data stores, or authentication managers inside . Inject them through
perform()and register them once in@DependencywithApp.init().AppDependencyManager.shared.add(dependency:) - Never use or manual concatenation for localized intent dialog. Use
String(format:), and use Foundation's grammar-agreement markdown (LocalizedStringResource) inside an^[\(count) item](inflect: true)for pluralization.AttributedString - Prefer for "take me to this thing" actions,
OpenIntentfor self-contained one-shot summaries, andAppIntent & ShowsSnippetView+ a pairedAppIntent & ShowsSnippetIntentwhen the snippet containsSnippetIntentand needs to re-render after buttons fire.Button(intent:) - Always set on helper intents that only back a widget button, snippet button, or other intent - otherwise they pollute the user's Shortcuts library.
static let isDiscoverable: Bool = false - When an intent mutates data that widgets or control widgets display, call inside
WidgetCenter.shared.reloadAllTimelines()before returning.perform() - When lives inside a widget view, share state between the intent (runs in the app process) and the widget's timeline provider (runs in the extension process) via App Group
Button(intent:)or a sharedUserDefaults(suiteName:)URL - neverModelContaineror in-memoryUserDefaults.standardstate.@Dependency - When entity data that appears in a shortcut phrase's key path changes (creation, rename, deletion), call to invalidate the cached candidate list.
YourShortcutsProvider.updateAppShortcutParameters() - Prefer when the whole set is small and cheap to load; implement
EnumerableEntityQuery+EntityQuerywhen the dataset is large or searchable; addEntityStringQueryto get a system-generated Find intent for free.EntityPropertyQueryis mandatory on every query; without it, parameter resolution breaks.entities(for identifiers:) - Mark entity fields that users might filter, sort, or reference in parameter summaries with (stored) or
@Property(derived). Plain stored properties are invisible to the App Intents framework.@ComputedProperty - Use for return data that's computed on the fly (summaries, aggregates). Don't try to shoehorn it into
TransientAppEntitywith a fake id.AppEntity - When the entity already has a universal-link URL, conform it to and conform the open intent to
URLRepresentableEntity- the system routes opens through your existing link handler without aURLRepresentableIntent.perform() - For entities visible onscreen that Siri should be able to understand, combine on the view with
.userActivity(_:element:)conformance on the entity. Identification alone is not enough; Siri needs exportable content.Transferable - is called multiple times per user interaction (initial show, after each button tap, on appearance changes, on
SnippetIntent.perform()). Keep it pure: read state, assemble the view, return. Never mutate app state or kick off slow work inside a snippet intent'sreload().perform() - Respect hard limits: 10 s per app, 1000 total trigger phrases (including parameter expansions). The first phrase in each shortcut's array is the primary one - it's shown on the Shortcuts home tile and as Siri's "what can I do with X?" answer.
AppShortcut - Include at least one non-parameterized phrase per App Shortcut so it's discoverable before first launch; parameterized phrases don't appear in Spotlight until the app has run once and populated the parameter cache.
- Prefer +
supportedModes(iOS 26+) overcontinueInForeground/ForegroundContinuableIntentfor new code that conditionally foregrounds. The newer form lets one intent declare it may run background or foreground based on runtime state.needsToContinueInForegroundError - Snippet views have a 340-point height ceiling; beyond this, scrolling breaks the glance overlay model. Link to the full app for deep content, and keep snippet text larger than system defaults for legibility at reading distance.
- For text parameters that may receive input from Apple Intelligence's Use Model action, declare the type as rather than
AttributedStringso rich formatting (bold, italic, lists, tables) is preserved losslessly.String - The app's struct initializer is executed when an intent runs, even if the UI never appears. Do all intent-relevant setup (
Appcreation,ModelContainer, log plumbing) insideAppDependencyManager.shared.add(...), not inside view modifiers likeinit()or.task..onAppear - is the standard string type everywhere in App Intents (titles, dialog, parameter prompts). It shares string catalogs with SwiftUI, so localization works out of the box.
LocalizedStringResource - Grammar agreement () works in English, French, German, Italian, Spanish, and Portuguese (both variants). For other locales it falls back to the unmodified form.
inflect: true
- App Intents最低支持iOS 16+ / macOS 13+。、
IndexedEntity、Focus Filters及控件小组件需要iOS 16+;OpenIntent/@AssistantEntity模式需要iOS 18.2+;锚定相对日期样式及多数助手模式需要iOS 18.4+。@AssistantIntent - 绝对不要让SwiftData 类或其他引用类型数据模型遵循
@Model。AppEntity要求AppEntity;Sendable类不具备Sendable特性。应创建单独的@Model实体,映射需要暴露的字段。struct - 绝对不要跨Actor边界传递。
ModelContext不具备Sendable特性。应传递ModelContext(具备Sendable特性),并在需要的Actor内部创建本地上下文。ModelContainer - 绝对不要仅通过编写类型将意图暴露给Siri/Spotlight,务必通过注册。未在此注册的类型不会出现在Shortcuts、Siri建议或操作按钮选择器中。
AppShortcutsProvider - 绝对不要编写未插入的Siri激活短语。App Intents宏会在编译时拒绝此类短语,因为不含应用名称的短语会与其他应用的命令冲突。
\(.applicationName) - 绝对不要从意图内部访问SwiftUI 。
@Query仅在@Query内部生效。应通过View执行一次性ModelContext,或通过集中式数据控制器路由。FetchDescriptor - 绝对不要在内部实例化服务、数据存储或认证管理器。应通过
perform()注入,并在@Dependency中通过App.init()注册一次。AppDependencyManager.shared.add(dependency:) - 绝对不要使用或手动拼接进行意图对话本地化。应使用
String(format:),并在LocalizedStringResource中使用Foundation的语法匹配标记(AttributedString)处理复数形式。^[\(count) item](inflect: true) - 对于“带我到该内容”的操作,优先使用;对于独立的一次性摘要,优先使用
OpenIntent;当代码片段包含AppIntent & ShowsSnippetView且按钮触发后需要重新渲染时,优先使用Button(intent:)+ 配对的AppIntent & ShowsSnippetIntent。SnippetIntent - 对于仅支持小组件按钮、代码片段按钮或其他意图的辅助意图,务必设置;否则会污染用户的Shortcuts库。
static let isDiscoverable: Bool = false - 当意图修改了小组件或控件小组件展示的数据时,需在返回前调用
perform()。WidgetCenter.shared.reloadAllTimelines() - 当位于小组件视图中时,需通过App Group
Button(intent:)或共享UserDefaults(suiteName:)URL在意图(运行于应用进程)与小组件时间线提供器(运行于扩展进程)之间共享状态——绝对不要使用ModelContainer或内存中的UserDefaults.standard状态。@Dependency - 当快捷短语键路径中显示的实体数据发生变化(创建、重命名、删除)时,调用以失效缓存的候选列表。
YourShortcutsProvider.updateAppShortcutParameters() - 当数据集较小且加载成本低时,优先使用;当数据集较大或可搜索时,实现
EnumerableEntityQuery+EntityQuery;添加EntityStringQuery可免费获得系统生成的Find意图。EntityPropertyQuery是每个查询的必填项;缺少该方法会导致参数解析失败。entities(for identifiers:) - 将用户可能筛选、排序或在参数摘要中引用的实体字段标记为(存储型)或
@Property(派生型)。普通存储属性对App Intents框架不可见。@ComputedProperty - 对于动态计算的返回数据(摘要、聚合结果),使用。不要试图通过伪造ID将其塞进
TransientAppEntity。AppEntity - 当实体已有通用链接URL时,让其遵循,并让打开意图遵循
URLRepresentableEntity——系统会通过现有链接处理程序路由打开操作,无需URLRepresentableIntent。perform() - 对于屏幕上显示且Siri应能识别的实体,将视图上的与实体的
.userActivity(_:element:)遵循相结合。仅识别是不够的;Siri需要可导出的内容。Transferable - 在每次用户交互中会被多次调用(初始显示、每次按钮点击后、外观变化时、
SnippetIntent.perform()时)。保持其纯函数特性:读取状态、组装视图、返回结果。绝对不要在代码片段意图的reload()内部修改应用状态或启动耗时操作。perform() - 遵守硬性限制:每个应用最多10个,总计1000个触发短语(包括参数扩展)。每个快捷方式数组中的第一个短语是主要短语——会显示在Shortcuts主页磁贴及Siri的“我可以用X做什么?”回答中。
AppShortcut - 每个App Shortcut至少包含一个非参数化短语,以便在首次启动前即可被发现;参数化短语在应用运行一次并填充参数缓存前不会出现在Spotlight中。
- 对于有条件前置的新代码,优先使用+
supportedModes(iOS 26+),而非continueInForeground/ForegroundContinuableIntent。新形式允许单个意图根据运行时状态声明在后台或前台运行。needsToContinueInForegroundError - 代码片段视图的高度上限为340点;超过此高度,滚动会破坏概览覆盖模型。对于深度内容,链接到完整应用,并保持代码片段文本大于系统默认值,以保证阅读距离下的可读性。
- 对于可能接收Apple Intelligence的Use Model操作输入的文本参数,将类型声明为而非
AttributedString,以无损保留富格式(粗体、斜体、列表、表格)。String - 应用的结构体初始化器会在意图运行时执行,即使UI从未显示。所有与意图相关的设置(
App创建、ModelContainer、日志管道)都要在AppDependencyManager.shared.add(...)内部完成,而非init()或.task等视图修饰器内部。.onAppear - 是App Intents中所有场景的标准字符串类型(标题、对话、参数提示)。它与SwiftUI共享字符串目录,因此本地化可直接生效。
LocalizedStringResource - 语法匹配()支持英语、法语、德语、意大利语、西班牙语和葡萄牙语(两种变体)。对于其他语言环境,会回退到未修改的形式。
inflect: true
Output Format
输出格式
If the user asks for a review, organize findings by file. For each issue:
- State the file and relevant line(s).
- Name the anti-pattern being replaced.
- Show a brief before/after code fix.
Skip files with no issues. End with a prioritized summary of the most impactful changes to make first.
If the user asks you to write or fix intent code, make the changes directly instead of returning a findings report.
Example output:
若用户请求审查,按文件整理发现的问题。每个问题需包含:
- 说明文件及相关行号。
- 指出要替换的反模式。
- 展示简短的修复前后代码对比。
跳过无问题的文件。最后给出按优先级排序的最具影响性变更摘要。
若用户请求编写或修复意图代码,直接进行修改,而非返回问题报告。
示例输出:
RecentItemsIntent.swift
RecentItemsIntent.swift
Line 18: SwiftData cannot conform to (not ).
@ModelAppEntitySendableswift
// Before
extension Article: AppEntity { ... }
// After
struct ArticleEntity: AppEntity {
var id: UUID
var title: String
static let typeDisplayRepresentation: TypeDisplayRepresentation = "Article"
static let defaultQuery = ArticleEntityQuery()
var displayRepresentation: DisplayRepresentation {
DisplayRepresentation(title: "\(title)")
}
}Line 42: Siri phrase missing - will fail to build.
\(.applicationName)swift
// Before
AppShortcut(intent: OpenArticleIntent(), phrases: ["Open an article"], ...)
// After
AppShortcut(intent: OpenArticleIntent(), phrases: ["Open an article in \(.applicationName)"], ...)第18行:SwiftData 无法遵循(不具备特性)。
@ModelAppEntitySendableswift
// 修改前
extension Article: AppEntity { ... }
// 修改后
struct ArticleEntity: AppEntity {
var id: UUID
var title: String
static let typeDisplayRepresentation: TypeDisplayRepresentation = "Article"
static let defaultQuery = ArticleEntityQuery()
var displayRepresentation: DisplayRepresentation {
DisplayRepresentation(title: "\(title)")
}
}第42行:Siri短语缺少——编译会失败。
\(.applicationName)swift
// 修改前
AppShortcut(intent: OpenArticleIntent(), phrases: ["Open an article"], ...)
// 修改后
AppShortcut(intent: OpenArticleIntent(), phrases: ["Open an article in \(.applicationName)"], ...)Summary
摘要
- Sendability (high): as
Articlewill fail to compile on Swift 6; create a shadow struct.AppEntity - Siri phrases (high): is required in every phrase.
\(.applicationName)
End of example.
- Sendability(高优先级): 将作为
Article在Swift 6上会编译失败;需创建影子结构体。AppEntity - Siri短语(高优先级): 每个短语都必须包含。
\(.applicationName)
示例结束。
References
参考文件
- -
references/fundamentals.mdprotocol,AppIntent, return types (perform(),IntentResult,ProvidesDialog,ReturnsValue,ShowsSnippetView), intent dialog, grammar agreement.OpensIntent - -
references/parameters.md, primitive vs entity parameters,@Parameter, dialog options, parameter prompts.@AppEnum - -
references/entities.md,AppEntity, shadow-struct pattern, display representations, entity queries (IndexedEntity,EnumerableEntityQuery,EntityQuery,EntityStringQuery).UniqueIDEntityQuery - -
references/shortcuts-and-siri.md, phrases (AppShortcutsProviderrule),\(.applicationName),shortcutTileColor,SiriTipView, parameter presentation.ShortcutsLink - -
references/open-and-snippet-intents.md, snippet views (OpenIntent), navigation via data controller, when to use which.ShowsSnippetView - -
references/dependencies.md,@Dependency, data-controller pattern,AppDependencyManagervsModelContainersendability, main-actor vs local-context tradeoff.ModelContext - -
references/spotlight.md,IndexedEntity,CSSearchableIndex, index-on-launch vs index-on-change, debounced reindexing.attributeSet - -
references/assistant-schemas.md,@AssistantEntity, schema adoption, Xcode code snippets, caveats.@AssistantIntent - - unit testing intents, mocking
references/testing-intents.mdvia@Dependency, Swift Testing patterns, what you can't unit-test.AppDependencyManager - - common mistakes LLMs make when generating App Intents code.
references/anti-patterns.md
- -
references/fundamentals.md协议、AppIntent、返回类型(perform()、IntentResult、ProvidesDialog、ReturnsValue、ShowsSnippetView)、意图对话、语法匹配。OpensIntent - -
references/parameters.md、基础类型与实体参数、@Parameter、对话选项、参数提示。@AppEnum - -
references/entities.md、AppEntity、影子结构体模式、展示形式、实体查询(IndexedEntity、EnumerableEntityQuery、EntityQuery、EntityStringQuery)。UniqueIDEntityQuery - -
references/shortcuts-and-siri.md、短语(AppShortcutsProvider规则)、\(.applicationName)、shortcutTileColor、SiriTipView、参数展示。ShortcutsLink - -
references/open-and-snippet-intents.md、代码片段视图(OpenIntent)、通过数据控制器导航、适用场景。ShowsSnippetView - -
references/dependencies.md、@Dependency、数据控制器模式、AppDependencyManager与ModelContainer的Sendability特性、主Actor与本地上下文的权衡。ModelContext - -
references/spotlight.md、IndexedEntity、CSSearchableIndex、启动时索引与变更时索引、防抖重新索引。attributeSet - -
references/assistant-schemas.md、@AssistantEntity、模式适配、Xcode代码片段、注意事项。@AssistantIntent - - 意图单元测试、通过
references/testing-intents.md模拟AppDependencyManager、Swift Testing模式、不可单元测试的内容。@Dependency - - 大语言模型生成App Intents代码时常见的错误。
references/anti-patterns.md