Apple Developer onepage/WWDC26
#WWDC26#AppIntents#Siri#Shortcuts2026-06-08 · 18:02

讓 App Intents 更可被系統理解:entities、parameters、execution 三條主線

這場 session 聚焦 App Intents 的進階能力:讓 entity 能跨 app 與跨裝置流動、讓大型 entity set 不拖慢執行、讓參數型別更貼近人類語意,並讓長時間 intent 有背景任務與進度 UI。

// 一句話結論

Apple 正把 App Intents 從「把 action 暴露給 Siri/Shortcuts」推向「讓 app content 成為系統可理解、可推薦、可跨裝置執行的語意層」。

Apple Developer · WWDC26 · Video ID: 6FkaEVs5G-cApple Developer 官方頁
Content map

這支影片在拆三類 App Intents 擴展痛點

Entity 可攜性

內容要能被其他 app 與裝置理解

ValueRepresentation 讓 entity 輸出系統懂的結構化型別;SyncableEntity 則用 stable ID 解決跨裝置 local ID 不一致問題。

Relevance

沒互動過的內容也要能被系統推薦

Spotlight indexing 與 interaction donation 只能反映已看過或已做過的內容。RelevantEntities 讓 app 主動提供特定情境下最相關的 entity。

Scale

大量 entity 不應在執行前全部 resolve

例如給上千張照片加 tag,如果每張都先 resolve 成完整 entity,intent 執行前就會慢。EntityCollection 讓 perform() 收到 ID collection,按需處理。

Execution

Intent 需要更長時間、更精準 process 與取消處理

LongRunningIntent 解開 30 秒限制並搭配 Live Activity progress;ExecutionTargets 讓 shared package 裡的 intent 指定該跑在 app、extension 或 widget。

Decision map

導入新 App Intents primitive 的判斷路徑

1

內容要交給其他 app 使用:加 ValueRepresentation

如果 entity 其實代表地點、聯絡人、檔案或其他系統已知概念,提供 structured value,比只靠 Transferable 的 file/data representation 更有語意。

2

內容需要在特定情境被推薦:註冊 RelevantEntities

在 workout、trip、editing session 等情境啟動時呼叫 updateEntities,結束時依 context 或 entity 移除,避免系統推薦過期內容。

3

entity 數量很大:改用 EntityCollection

若 bottleneck 是 intent 執行前的 entity resolution,把 parameter type 改成 collection,讓 perform() 用 identifiers 操作,避免預先載入全部資料。

4

跨裝置對話要延續:實作 SyncableEntity

用 server UUID 或 CloudKit record ID 作 stable ID;若只有 local ID,使用 SyncableEntityIdentifier 同時提供 local 與 stable mapping。

5

工作超過 30 秒或要指定 process:加 LongRunningIntent / ExecutionTargets

長工作包進 performBackgroundTask、回報 progress、處理 cancellation;shared package 則用 execution targets 指定 main app 或 extension。

重點 1:Entity 不只是 app 內資料,還要能被系統語意化

App Intents 原本就能讓 Siri、Shortcuts、Spotlight、Widgets 與 Apple Intelligence 使用 app 的 action 和 content。WWDC26 這場 session 的新方向,是讓 entity 更像系統語意網路的一部分:能轉成其他 app 懂的結構、能在正確情境被推薦、能在大量資料與多裝置情境下保持穩定。

影片範例用 Landmarks Travel Tracking app 說明:landmark 可以用 ValueRepresentation 匯出成 GeoToolbox 的 PlaceDescriptor,讓 Maps 可以直接拿去做 directions,而不是只能作為 app 自己的 opaque object。

ValueRepresentation補上 structured value,讓 entity 跨 app 流動時保留語意;若 entity 已有相同屬性,可用 key path 快速映射。
RelevantEntities讓 app 依 context 主動提供相關 entity,例如 workout 開始時推薦 running playlists,結束後移除該 context。
EntityCollection大型 entity set 不需要先 resolve 全部資料;perform() 可直接收到 identifiers collection,按需處理。
SyncableEntity跨裝置 Siri conversation 需要 stable ID。server UUID 或 CloudKit record ID 比單機 local ID 更適合系統層接力。

重點 2:參數型別越貼近語意,系統 UI 與語音理解越不用自建

影片提醒,宣告 @Parameter 不只是拿到一個 Swift 參數;系統會自動提供 native picker、Siri understanding 與 localization。WWDC26 擴充更多 native types,例如 Duration 與 PersonNameComponents,讓開發者不用為常見語意重做自訂 picker 或 parsing。

@UnionValue 則處理另一種常見需求:一個參數可接受多種型別。例如 widget 可以顯示「landmark collection」或「photo album」其中之一;macro 會生成型別資訊、case metadata 與 picker 支援,並可用在 Shortcuts 等系統入口。

重點 3:Long-running intent 把背景任務、進度與取消拉進標準模型

傳統 intent 通常有 30 秒限制。LongRunningIntent 讓更長的工作可被系統管理背景任務 lifecycle,並透過 Live Activity 顯示 progress。這對匯出、批次處理、生成內容、長時間影像/資料處理很重要。

01
把長工作包進 performBackgroundTask
讓系統知道這是需要背景生命週期管理的 intent,而不是一般短 action。
02
回報 progress,不要只等完成
LongRunningIntent 建立在 ProgressReportingIntent 之上,使用者能在 Live Activity 中看到處理進度。
03
實作 CancellableIntent 清理資源
取消不是單純中止 UI;要釋放檔案、暫停網路/模型工作,並把 partial state 收乾淨。

風險與遷移注意事項

RelevantEntities 要有生命週期只新增不移除會讓系統推薦過期內容。設計 context key,並在情境結束後 remove by context 或 entity。
EntityCollection 不該犧牲授權檢查雖然 perform() 可直接拿 identifiers,但仍要在實際操作前檢查權限、資料存在性與可見性。
Stable ID 要真的跨裝置穩定local database row ID 不適合當 SyncableEntity stable ID。優先使用 server UUID 或 CloudKit record ID。
ExecutionTargets 要避免猜錯 processshared package 同時被 app 與 extension link 時,系統 heuristic 不一定符合資料寫入需求;需要明確指定。

章節索引

Chapters
0:00
Introduction:entity enhancements、richer parameters、intent execution
2:40
ValueRepresentation:用 structured value 跨 app 分享 entity
3:45
RelevantEntities:依 context 註冊最相關內容
7:05
EntityCollection:大型 entity set 的效能路徑
8:55
SyncableEntity:跨裝置穩定 ID
11:01
Richer parameter types:Duration、PersonNameComponents
12:38
Union value parameters:一個參數接受多型別
13:26
LongRunningIntent:背景任務、Live Activity progress、取消
15:27
ExecutionTargets:指定 intent 執行 process
17:14
Next steps:Code-along 與 AppIntentsTesting

來源

主要來源為 Apple Developer 官方影片頁、官方 transcript、章節與 documentation links;YouTube 影片頁用於 iframe 與發布 metadata。官方頁:Discover new capabilities in the App Intents framework - WWDC26。YouTube:WWDC26: Discover new capabilities in the App Intents framework | Apple。相關文件:App Intents。

// TL;DR