Skip to content

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.

ParameterTypeRequiredDefaultDescription
namestringYesThe name of the widget (e.g., "DailyStats" generates a DailyStatsWidget extension)
outputPathstringYesAbsolute path to the directory where the widget extension folder will be created
kindstringNo"static"The widget configuration type. Accepted values: "static", "configurable"

“Create a widget called DailyStats for showing fitness progress on the home screen”

{
"name": "DailyStats",
"outputPath": "/Users/dev/Projects/FitnessTracker"
}

“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"
}
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: Static
Configuration: StaticConfiguration

When 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: Configurable
Configuration: AppIntentConfiguration
  • scaffold_view — Create additional SwiftUI views used within the widget
  • project_create — Create the host app project if you have not started one
  • xcode_build — Build the widget extension target to verify it compiles