View in English

  • Apple 开发者
    • 入门汇总

    探索“入门汇总”

    • 概览
    • 学习
    • Apple Developer Program

    及时了解最新动态

    • 最新动态
    • 开发者你好
    • 平台

    探索“平台”

    • Apple 平台
    • iOS
    • iPadOS
    • macOS
    • Apple tvOS
    • visionOS
    • watchOS
    • App Store

    精选

    • 设计
    • 分发
    • 游戏
    • 配件
    • 网页
    • Home
    • CarPlay 车载
    • 技术

    探索“技术”

    • 概览
    • Xcode
    • Swift
    • SwiftUI

    精选

    • 辅助功能
    • App Intents
    • Apple 智能
    • 游戏
    • 机器学习与 AI
    • 安全性
    • Xcode Cloud
    • 社区

    探索“社区”

    • 概览
    • “与 Apple 会面交流”活动
    • 社区主导的活动
    • 开发者论坛
    • 开源

    精选

    • WWDC
    • Swift Student Challenge
    • 开发者故事
    • App Store 大奖
    • Apple 设计大奖
    • Apple Developer Centers
    • 文档

    探索“文档”

    • 文档库
    • 技术概述
    • 示例代码
    • 《人机界面指南》
    • 视频

    发布说明

    • 精选更新
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • Apple tvOS
    • Xcode
    • 下载

    探索“下载”

    • 所有下载
    • 操作系统
    • 应用程序
    • 设计资源

    精选

    • Xcode
    • TestFlight
    • 字体
    • SF Symbols
    • Icon Composer
    • 支持

    探索“支持”

    • 概览
    • 帮助指南
    • 开发者论坛
    • “反馈助理”
    • 联系我们

    精选

    • 《开发者账户帮助》
    • 《App 审核指南》
    • 《App Store Connect 帮助》
    • 即将实行的要求
    • 协议和准则
    • 系统状态
  • 快速链接

    • 活动
    • 新闻
    • 论坛
    • 示例代码
    • 视频
 

视频

打开菜单 关闭菜单
  • 专题
  • 所有视频
  • 关于

更多视频

  • 简介
  • 概要
  • 代码
  • WidgetKit 基础知识

    小组件可在系统各处突出显示你 App 中最重要的内容,让用户有更多机会与你的 App 交互。探索不同类型的小组件,以及令人印象深刻的小组件需要具备的特质。了解如何创建小组件、让小组件保持最新状态,并利用 App Intents 和动态样式为用户提供自定义小组件的选项。

    章节

    • 0:01 - Introduction
    • 1:03 - Fundamentals
    • 13:15 - Integrate with your app
    • 17:04 - Adapt with the system

    资源

      • 高清视频
      • 标清视频

    相关视频

    WWDC26

    • 实时活动基础知识

    WWDC25

    • 小组件的新功能

    WWDC23

    • 如何让小组件更加生动
    • 探索 App Intents 的增强功能

    WWDC21

    • 优秀小组件的原则
  • 搜索此视频…
    • 3:50 - DailyReadingGoalWidget

      struct DailyReadingGoalWidget: Widget {
          let kind = "DailyReadingGoalWidget"
          
          var body: some WidgetConfiguration {
              StaticConfiguration(
                  kind: kind,
                  provider: DailyReadingGoalProvider()
              ) { entry in
                  DailyReadingGoalView(book: entry.book,
                                       message: entry.message,
                                       timeOfDay: entry.timeOfDay)
                  .environment(\.colorScheme, .dark)
                  .containerBackground(for: .widget) {
                      Background()
                  }
              }
          }
      }
    • 12:25 - Supported Families

      struct DailyReadingGoalWidget: Widget {
          let kind = "DailyReadingGoalWidget"
      
          var body: some WidgetConfiguration {
              StaticConfiguration(
                  kind: kind,
                  provider: DailyReadingGoalProvider()
              ) { entry in
                  DailyReadingGoalView(book: entry.book,
                                       message: entry.message,
                                       timeOfDay: entry.timeOfDay)
                  .environment(\.colorScheme, .dark)
                  .containerBackground(for: .widget) {
                      Background()
                  }
              }
              .supportedFamilies([.systemMedium])
          }
      }
    • 14:03 - Adding deep links

      struct DailyReadingGoalWidget: Widget {
          let kind = "DailyReadingGoalWidget"
      
          var body: some WidgetConfiguration {
              StaticConfiguration(
                  kind: kind,
                  provider: DailyReadingGoalProvider()
              ) { entry in
                  DailyReadingGoalView(book: entry.book,
                                       message: entry.message,
                                       timeOfDay: entry.timeOfDay)
                  .environment(\.colorScheme, .dark)
                  .containerBackground(for: .widget) {
                      Background()
                  }
                  .widgetURL(URL(string: "bookclub://reading/\(book.bookID)"))
              }
              .supportedFamilies([.systemMedium])
          }
      }
    • 18:17 - Accented rendering mode

      struct BookCoverImage: View {
          let imageName: String
      
          var body: some View {
              Image(imageName: bundle: .main)
                  .widgetAccentedRenderingMode(.fullColor)
          }
      }
    • 0:01 - Introduction
    • Widgets highlight your app's most important content across the system. The best widgets are glanceable, relevant, and personalizable. Learn how to build your first widget and keep it up to date, extending the reach of your app across platforms with WidgetKit and SwiftUI.

    • 1:03 - Fundamentals
    • Widgets should be glanceable, relevant, and personalizable. They are built by creating a widget extension that exposes a timeline of TimelineEntry values. Each TimelineEntry provides the data to render a SwiftUI view at a particular moment in time. Learn how to define a widget with a StaticConfiguration or AppIntentConfiguration, build a quality TimelineProvider, and select a timeline reload policy to keep your widget up to date. Discover the various sizes and placements for widgets with .supportedFamilies — including the new systemExtraLargePortrait family coming to macOS, iOS, and iPadOS 27.

    • 13:15 - Integrate with your app
    • WidgetKit offers three key integration points to tighten the connection between a widget and your app. Deep links route taps directly to specific content in your app. Configurable widgets let people personalize widget content. Interactive elements that let people perform the most important actions from within your app using App Intents.

    • 17:04 - Adapt with the system
    • Widgets are dynamic and adapt with the system appearance modes like full color, tinted, and clear. SwiftUI handles most of the adaptation automatically, though you can customize the behavior of particular Views with the .widgetAccentedRenderingMode(.fullColor) modifier. Learn techniques to test your widgets for considerations with appearance modes and budgeted reloads.

Developer Footer

  • 视频
  • WWDC26
  • WidgetKit 基础知识
  • 打开菜单 关闭菜单
    • iOS
    • iPadOS
    • macOS
    • Apple tvOS
    • visionOS
    • watchOS
    打开菜单 关闭菜单
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • SF Symbols
    打开菜单 关闭菜单
    • 辅助功能
    • 配件
    • Apple 智能
    • App 扩展
    • App Store
    • 音频与视频 (英文)
    • 增强现实
    • 设计
    • 分发
    • 教育
    • 字体 (英文)
    • 游戏
    • 健康与健身
    • App 内购买项目
    • 本地化
    • 地图与位置
    • 机器学习与 AI
    • 开源资源 (英文)
    • 安全性
    • Safari 浏览器与网页 (英文)
    打开菜单 关闭菜单
    • 完整文档 (英文)
    • 部分主题文档 (简体中文)
    • 教程
    • 下载
    • 论坛 (英文)
    • 视频
    打开菜单 关闭菜单
    • 支持文档
    • 联系我们
    • 错误报告
    • 系统状态 (英文)
    打开菜单 关闭菜单
    • Apple 开发者
    • App Store Connect
    • 证书、标识符和描述文件 (英文)
    • 反馈助理
    打开菜单 关闭菜单
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program (英文)
    • Mini Apps Partner Program
    • News Partner Program (英文)
    • Video Partner Program (英文)
    • 安全赏金计划 (英文)
    • Security Research Device Program (英文)
    打开菜单 关闭菜单
    • 与 Apple 会面交流
    • Apple Developer Center
    • App Store 大奖 (英文)
    • Apple 设计大奖
    • Apple Developer Academies (英文)
    • WWDC
    阅读最近新闻。
    获取 Apple Developer App。
    版权所有 © 2026 Apple Inc. 保留所有权利。
    使用条款 隐私政策 协议和准则