0Pricing
Swift Academy · Lesson

Building a WidgetKit Widget

Create a home-screen widget with a timeline.

What a Widget Is

A widget is a small, glanceable view that lives on the Home Screen, Lock Screen, or in StandBy. It is not a mini-app — it cannot scroll or run arbitrary code. It displays a snapshot of data that the system refreshes on a schedule you provide via WidgetKit.

import WidgetKit
import SwiftUI
// A widget = configuration + timeline of entries
// + a SwiftUI view that renders one entry

The Widget Extension Target

Widgets ship in a separate Widget Extension target, not the main app. It has its own bundle and runs in its own process. You add it via Xcode's Widget Extension template, which scaffolds the configuration and provider.

import WidgetKit
// File > New > Target > Widget Extension
// The extension declares one or more widgets
// in a WidgetBundle if you have several.

All lessons in this course

  1. Building a WidgetKit Widget
  2. Timeline Providers and Snapshots
  3. App Extensions Overview
  4. App Intents and Shortcuts
← Back to Swift Academy