Build home screen and lock screen widgets using SwiftUI. WidgetKit provides a unified API for creating glanceable, personalized widgets across iOS, iPadOS, and macOS.
of iOS users worldwide can use WidgetKit (iOS 14+ required)
| iOS Version | Market Share | Status |
|---|---|---|
| iOS 18.7 | 30.3% | Supported |
| iOS 18.6 | 29.8% | Supported |
| iOS 26.1 | 10.7% | Supported |
| iOS 18.5 | 6.0% | Supported |
| iOS 16.7 | 2.3% | Supported |
| iOS 26.2 | 2.0% | Supported |
| iOS 18.3 | 1.8% | Supported |
| iOS 15.8 | 1.8% | Supported |
| iOS 17.6 | 1.7% | Supported |
| iOS 26.0 | 1.3% | Supported |
Build widgets entirely with SwiftUI
Support for multiple widget sizes
Timeline-based content updates
Lock screen widget support (iOS 16+)
App Intents for interactive widgets (iOS 17+)
Home screen and StandBy mode support
Create a basic widget using WidgetKit and SwiftUI
import WidgetKit
import SwiftUI
struct SimpleWidget: Widget {
let kind: String = "SimpleWidget"
var body: some WidgetConfiguration {
StaticConfiguration(kind: kind, provider: Provider()) { entry in
SimpleWidgetEntryView(entry: entry)
}
.configurationDisplayName("My Widget")
.description("This is an example widget.")
.supportedFamilies([.systemSmall, .systemMedium, .systemLarge])
}
}Provide timeline entries to update widget content
import WidgetKit
struct Provider: TimelineProvider {
func placeholder(in context: Context) -> SimpleEntry {
SimpleEntry(date: Date(), text: "Placeholder")
}
func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> ()) {
let entry = SimpleEntry(date: Date(), text: "Snapshot")
completion(entry)
}
func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
var entries: [SimpleEntry] = []
let currentDate = Date()
for hourOffset in 0 ..< 5 {
let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)!
let entry = SimpleEntry(date: entryDate, text: "Hour \(hourOffset)")
entries.append(entry)
}
let timeline = Timeline(entries: entries, policy: .atEnd)
completion(timeline)
}
}
struct SimpleEntry: TimelineEntry {
let date: Date
let text: String
}Display widget content with SwiftUI
import SwiftUI
import WidgetKit
struct SimpleWidgetEntryView: View {
var entry: Provider.Entry
var body: some View {
VStack {
Text(entry.date, style: .time)
.font(.headline)
Text(entry.text)
.font(.caption)
}
.containerBackground(.fill.tertiary, for: .widget)
}
}Build home screen and lock screen widgets using SwiftUI. WidgetKit provides a unified API for creating glanceable, personalized widgets across iOS, iPadOS, and macOS.
WidgetKit is available on iOS 14 and later. Currently, 97.1% of iOS users worldwide can use this framework.
Related frameworks include Swiftui, Appintents. Each has different capabilities and iOS version requirements.