为 iOS App 增加系统动作入口
App Intents 能把 iOS app 的动作和内容暴露给 Shortcuts、Siri、Spotlight、widgets、controls,以及新的
App Intents 能把 iOS app 的动作和内容暴露给 Shortcuts、Siri、Spotlight、widgets、controls,以及新的 assistant-driven system experiences。Codex 适合先审计 app 里最有价值的 actions 和 core objects,再实现小而清晰的 intent surface。
官方页面:https://developers.openai.com/codex/use-cases/ios-app-intents
适合什么任务
| 场景 | Codex 应该做什么 |
|---|---|
| iOS app 已有有价值动作或内容,但系统侧不可见 | 找出最适合暴露到 Shortcuts、Siri、Spotlight 的 actions 和 objects |
| 团队想先暴露少量高价值动作 | 做第一批 App Intents、AppEntity 和 App Shortcuts,不 mirror 整个内部模型 |
| app 有 accounts、lists、filters、destinations、drafts、media 等清晰对象 | 定义窄的 entity surface,让系统能理解和路由 |
| intent 需要回到主 UI | 实现 clean handoff,让 app scene 能打开正确 screen 或 workflow |
使用的能力
| 能力 | 用法 | 链接 |
|---|---|---|
build-ios-apps | 使用 iOS build 和 SwiftUI skills 添加 App Intents、app entities、App Shortcuts,并验证 app 仍能 build 和正确路由 intent-driven entry points | https://github.com/openai/plugins/tree/main/plugins/build-ios-apps |
相关官方说明:
- App Intents overview:https://developer.apple.com/documentation/appintents/making-actions-and-content-discoverable-and-widely-available
- Creating your first app intent:https://developer.apple.com/documentation/appintents/creating-your-first-app-intent
- Apple system experiences sample:https://developer.apple.com/documentation/appintents/adopting-app-intents-to-support-system-experiences
起始提示词
请使用 Build iOS Apps plugin 审计这个 iOS app,并为应该暴露给系统的 actions 和 entities 添加 App Intents。
约束:
- 先识别 app 中最高价值的 user actions 和 core objects,这些内容应该能在 app 外被 Shortcuts、Siri、Spotlight、widgets、controls 或新的 assistant-driven system surfaces 使用。
- 第一版保持聚焦。选择一小组不打开完整 app 也真正有用的 intents,再加上需要 deep-link 到特定 screen 或 workflow 的 open-app intents。
- 只为系统理解和路由这些 actions 所需的数据定义 app entities。如果更小的 entity surface 足够,不要 mirror 整个内部 model layer。
- 在能提升可发现性的位置添加 App Shortcuts,并选择适合 Siri、Spotlight 和 Shortcuts 的 titles、phrases 和 display representations。
- 如果 app 需要在主 UI 中处理 intent,请把结果干净地 route 回 app,并解释 app scene 如何响应这个 handoff。
- 第一版完成后 build 并 validate app,然后总结现在支持哪些 actions、entities 和 system surfaces。
交付:
- first release 推荐的 intent 和 entity surface
- 已实现的 intents、entities 和 App Shortcuts
- app 在 runtime 如何 route 或 handle 这些 intents
- 这些改动现在解锁了哪些 Apple system experiences,下一步自然扩展是什么这个 prompt 明确要求 first pass focused。不要把整个 app model layer 暴露给系统,只暴露系统理解和路由真正需要的部分。
推荐技术面
| 需要 | 推荐默认值 | 原因 |
|---|---|---|
| Action exposure | App Intents | 让 app actions 出现在 Shortcuts、Siri、Spotlight、widgets、controls 和 assistant-facing surfaces |
| App data surface | AppEntity、EntityQuery、display representations | 让系统理解 app objects,但不暴露完整内部模型 |
| Discoverability layer | AppShortcutsProvider,配 clear phrases、titles、symbols | 让第一批动作更容易被找到和运行 |
| Validation loop | xcodebuild、simulator checks、focused runtime routing verification | 难点不只是编译 intents target,而是证明系统调用 intent 后能打开或路由到正确位置 |
从 Actions 和 Entities 开始
第一轮 App Intents 不应该 mirror whole app。让 Codex 先识别:
- 用户希望不打开完整 app 也能触发的少数 actions。
- 系统为了正确路由这些 actions 需要理解的 app objects。
- 哪些 workflow 应该直接在 system surface 完成,哪些应该 open app 到特定 state。
Apple 的 App Intents guidance 是很好的框架:定义 action,定义系统需要的 entity surface,再让这些 actions 在 system experiences 中可发现、可复用。
按 System Surfaces 思考
App Intents 不只是“加一个 shortcut”。它能让 app 在多个系统入口变得更有用:
- Shortcuts:用户直接运行 actions,或组合进更大的 automations。
- Siri:暴露有意义的 verbs 和 deep links,而不是只泛泛打开 app。
- Spotlight:app entities 和 app shortcuts 成为可发现的入口。
- widgets、Live Activities、controls 等 intent-driven UI surfaces。
- assistant-facing experiences:structured actions 和 entities 比任意 UI flow 更容易被系统理解。
采用真实 App Pattern
多数 app 适合这种结构:
- 单独的 App Intents target,而不是把 intent types 散落在无关文件里。
- 为高价值 actions 写
AppShortcutsProvider,例如 compose post 或 open app on a specific tab。 - 为系统需要理解的对象定义小型
AppEntity,例如 accounts、lists、timeline filters。 - intent handling 能 cleanly route 回 main app scene,让 invoked intent 打开正确 compose flow 或切到正确 tab。
实用建议
暴露用户真的想在 app 外触发的 verbs
好的第一批 intents 通常是 compose、open、find、filter、start、continue、inspect。需要很长 in-app setup 的动作,不适合第一轮暴露。
Entity 小于 model layer
系统通常不需要完整 persistence model。让 Codex 只定义能给 Siri、Shortcuts、Spotlight 提供路由和展示上下文的最小 entity surface。
把它当成 assistant infrastructure
即使第一版只明显改善 Shortcuts 或 Siri,更深层价值是 app 开始用 structured actions 和 entities 表达能力。未来进入更多 system / AI-driven entry points 会比只靠 taps 和 view hierarchy 的 app 更容易。