WWDC25

2025 年 6 月 9 日

WWDC 2025 WidgetKit 史上最大更新!iOS 26 玻璃風格、visionOS 空間 Widget、CarPlay 全車開放、watchOS Relevance + Push 一次看懂

已複製到剪貼板


WWDC 2025「What’s new in widgets」議程帶來 WidgetKit 史上最全面的更新!不管是 iOS 26 的玻璃與色調新外觀、visionOS 26 完整的空間 Widget 支援、CarPlay 全車系開放、macOS Tahoe 的 Live Activities,還是 watchOS 26 的 Relevance Widgets 與跨裝置 Push 更新機制,本文一次整理所有重點,讓你的 Widget 不僅能「隨處出現」,還能「隨時保持最新」。開發者快跟著一起升級,讓 App 即使不在前景也能持續為使用者帶來價值!

WWDC 2025:What’s new in widgets
WWDC 2025:What’s new in widgets

Widget 的全新視覺風格:玻璃與色調呈現

在 iOS 26 的主畫面,你現在可以將圖示與 Widget 設定為「清透玻璃」效果,或選擇特定色調(如藍色)來自訂外觀。相同風格也延伸到 macOS Tahoe 的桌面與通知中心。

Accented Rendering 模式與適配技巧

這些新呈現方式背後的原理是:先以「accented rendering mode」將 Widget 內容渲染成白色,移除原背景後再套用玻璃或色調效果。大多數 Widget 無需修改就能直接適配,但若有大圖片或漸層,就需要特別處理。

  • 使用 widgetRenderingMode 環境變數判斷是否為全彩模式,條件式顯示圖片與漸層
  • 對 Image 套用 .widgetAccentedRenderingMode(.desaturated).accentedDesaturated 讓圖片自然融入
  • 五種模式(nil、accented、desaturated、accentedDesaturated、fullColor)可精準控制不同平台(iOS / macOS / watchOS)的呈現效果

visionOS 26:Widget 正式登陸空間運算平台

如果你已經有 iPhone / iPad 的 Widget,現在自動就能在 visionOS 使用!支援所有系統尺寸,包含互動與動畫。

  • 可「釘在表面」(elevated)或「嵌入表面」(recessed),使用 supportedMountingStyles 控制
  • 新增 widgetTexture 可切換玻璃或紙質紋理,打造海報風格
  • 全新 systemExtraLargePortrait 直式超大尺寸家族
  • 支援色調主題,內容會自動切換為 accented rendering
  • 全新 levelOfDetail 環境變數:距離遠時自動切換為簡化版本(放大數字、隱藏按鈕)

CarPlay 全車系開放 Widgets 與 Live Activities

iOS 26 起,所有 CarPlay 車款都能在儀表板左側看到 Widget 堆疊。Live Activities 也會出現在 CarPlay 主畫面。

  • Widget 以 StandBy 風格呈現,使用 systemSmall + fullColor + 移除背景
  • Live Activities 可使用 supplementalActivityFamilies(.small) 提供專屬小尺寸版面
  • 同時大幅改善配對 Apple Watch Smart Stack 的顯示效果

macOS Tahoe 的 Live Activities

來自 iPhone 的 Live Activities 現在會出現在 macOS 選單列(類似 Dynamic Island 的 leading + trailing),點擊後會以 iPhone 鎖定畫面樣式呈現,並透過 iPhone Mirroring 開啟 App。

Controls 跨 macOS 與 watchOS 26 的新位置

macOS 可將 Controls 放在 Control Center 或選單列;watchOS 26 則支援 Control Center、Action Button(Ultra 專屬)與 Smart Stack。

watchOS 26 重磅新功能:Relevance Widgets

不再只是固定 Timeline,現在可以讓 Widget「只在相關時段出現」!咖啡店半價時段 Widget 就是最佳範例。

  • 使用 RelevanceConfiguration + RelevanceEntriesProvider
  • relevance(context:) 方法定義日期區間,系統會自動顯示/隱藏
  • 同時相關的多個配置會同時出現在 Smart Stack

跨裝置保持 Widget 即時更新:Widget Push Notifications

除了傳統 TimelineReloadPolicy 與 WidgetCenter.reloadTimelines,現在新增 Widget Push 更新機制,讓伺服器主動推播更新。

  • 實作 WidgetPushHandler 取得 push token 並上傳伺服器
  • 在 WidgetConfiguration 加上 .pushHandler(MyPushHandler.self)
  • 新增 Push Notification entitlement
  • 伺服器發送 HTTPS POST 到 APNs,使用 topic bundleID.push-type.widgets
  • aps 字典中設定 "content-state": {"content-changed": true}

結語與開發建議

今年 WidgetKit 真正做到「無所不在、隨時更新」。建議大家盡快:

  • 檢查 Widget 在 accented rendering 下的呈現
  • 為 visionOS 準備空間適配版本
  • 在 CarPlay 與 watchOS 測試新位置
  • 如果資料可能來自伺服器或跨裝置,務必加上 Widget Push 更新

快打開 Xcode 動手試試吧!你的 Widget 即將跟著使用者一起走遍 iPhone、iPad、Mac、Watch、Vision Pro 甚至 CarPlay。期待看到大家做出更精彩的 Widget 體驗!

分享文章

已複製到剪貼板

主題文章

查看 WWDC25

超級感謝

關於 XcodeProject

XcodeProject 創立於 2023,致力於協助開發者探索 Apple 的創新世界,學習在 iOS、iPadOS、macOS、tvOS、visionOS 與 watchOS 上開發 App,發現眾多技術與框架,讓開發者獲得更多能力。


Contacts

Ricky Chuang

XcodeProject

RickyChuang.xcodeproj@gmail.com

XcodeProject 聯絡

contact.xcodeproj@gmail.com

最新文章