Widget types
Thewidget target type supports multiple WidgetKit features:
Home Screen Widgets
Static and dynamic widgets on iOS and iPadOS home screens
Live Activities
Real-time updates in Dynamic Island and Lock Screen
Control Widgets
Interactive controls in Control Center and Lock Screen
Smart Stacks
Context-aware widget rotation in widget stacks
Extension point
| Property | Value |
|---|---|
| Extension Point | com.apple.widgetkit-extension |
| Product Type | com.apple.product-type.app-extension |
| Frameworks | WidgetKit, SwiftUI, ActivityKit, AppIntents |
| App Groups | Enabled by default |
Creating a widget
Widget colors
Widgets use two special colors with corresponding Xcode build settings:| Color Name | Build Setting | Purpose |
|---|---|---|
$widgetBackground | ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME | Widget background color |
$accent | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME | Tint color for buttons and interactive elements |
Live Activities
Live Activities requireActivityKit framework (included by default):
Control Widgets
Control widgets appear in Control Center (iOS 18+):Sharing data with widgets
Use App Groups to share data between your app and widget:Watch widgets
For Apple Watch complications, use thewatch-widget target type instead:
Best practices
Optimize for performance
Optimize for performance
- Keep widget code lightweight
- Use
TimelineProviderefficiently - Minimize network requests
- Cache images and data
Design for glanceability
Design for glanceability
- Show the most important information first
- Use clear typography and spacing
- Support all widget sizes (small, medium, large)
- Test in both light and dark mode
Handle data updates
Handle data updates
- Use App Groups for data sharing
- Call
reloadWidget()after data changes - Implement background updates for time-sensitive data
- Handle missing or stale data gracefully
Troubleshooting
Widget doesn't appear on home screen
Widget doesn't appear on home screen
On iOS 18+, long-press your app icon and select widget display options to transform the app icon into the widget. On earlier iOS versions, add the widget from the home screen widget picker.
SwiftUI previews not working
SwiftUI previews not working
Clear the SwiftUI preview cache:
Widget not updating
Widget not updating
Verify:
- App Groups entitlement is correctly configured
- You’re calling
ExtensionStorage.reloadWidget() - The widget’s
TimelineProvideris returning new entries
Production example
Check out Evan Bacon’s Pillar Valley widget for a real-world implementation.Learn more
Sharing data
Share data between app and widget
Control widgets
Build Control Center widgets
Widget guide
Detailed widget implementation guide
Apple documentation
Official WidgetKit documentation