-
WidgetKit 기초
위젯은 시스템 전반에서 앱의 중요한 콘텐츠를 강조하여 사용자에게 또 다른 참여 기회를 제공합니다. 위젯의 다양한 유형을 알아보고 기억에 남게 만드는 특성을 살펴보세요. 어떻게 위젯을 생성하고 최신 상태로 유지하며, 앱 인텐트와 동적 스타일링을 통해 사용자가 위젯을 맞춤 설정할 수 있는 다양한 방법을 제공할 수 있는지 알아보세요.
챕터
- 0:01 - Introduction
- 1:03 - Fundamentals
- 13:15 - Integrate with your app
- 17:04 - Adapt with the system
리소스
관련 비디오
WWDC26
WWDC25
WWDC23
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.