scaffold_widget
Generate a WidgetKit extension target with all required boilerplate including a TimelineProvider, TimelineEntry, widget view, and configuration. This tool creates either a static or configurable widget, setting up the complete file structure needed to display a widget on the home screen.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | — | The name of the widget (e.g., "DailyStats" generates a DailyStatsWidget extension) |
outputPath | string | Yes | — | Absolute path to the directory where the widget extension folder will be created |
kind | string | No | "static" | The widget configuration type. Accepted values: "static", "configurable" |
Usage Examples
Section titled “Usage Examples”Create a static widget
Section titled “Create a static widget”“Create a widget called DailyStats for showing fitness progress on the home screen”
{ "name": "DailyStats", "outputPath": "/Users/dev/Projects/FitnessTracker"}Create a configurable widget
Section titled “Create a configurable widget”“Scaffold a configurable widget called WorkoutGoal that lets users pick which goal to track”
{ "name": "WorkoutGoal", "outputPath": "/Users/dev/Projects/FitnessTracker", "kind": "configurable"}Create a static widget in a specific extensions folder
Section titled “Create a static widget in a specific extensions folder”“Generate a static CalorieCounter widget inside the Extensions directory”
{ "name": "CalorieCounter", "outputPath": "/Users/dev/Projects/FitnessTracker/Extensions", "kind": "static"}Example Output
Section titled “Example Output”Created widget extension: /Users/dev/Projects/FitnessTracker/DailyStatsWidget
Files generated: DailyStatsWidget/ DailyStatsWidget.swift DailyStatsWidgetBundle.swift DailyStatsTimelineProvider.swift DailyStatsEntry.swift DailyStatsWidgetView.swift Assets.xcassets/ Info.plist
Widget type: StaticConfiguration: StaticConfigurationWhen kind is set to "configurable":
Created widget extension: /Users/dev/Projects/FitnessTracker/WorkoutGoalWidget
Files generated: WorkoutGoalWidget/ WorkoutGoalWidget.swift WorkoutGoalWidgetBundle.swift WorkoutGoalTimelineProvider.swift WorkoutGoalEntry.swift WorkoutGoalWidgetView.swift WorkoutGoalIntent.swift Assets.xcassets/ Info.plist
Widget type: ConfigurableConfiguration: AppIntentConfigurationRelated Tools
Section titled “Related Tools”scaffold_view— Create additional SwiftUI views used within the widgetproject_create— Create the host app project if you have not started onexcode_build— Build the widget extension target to verify it compiles