SwiftUI Basic WidgetKit Starter Source Code: Build Your First Simple iOS Widget in Xcode
Build your first iOS widget with this clean, beginner-friendly SwiftUI and WidgetKit source code!
This starter pack includes a source code (Xcode Project files) of a static widget using TimelineProvider
, StaticConfiguration
, and SwiftUI
views — perfect for iOS developers who want to learn how widgets work and display dynamic content like motivational quotes and background colors.
Code is well commented and provides basic functionality.
- ✅ Full SwiftUI + WidgetKit source code (Xcode 16.2 / iOS 18.2 tested)
- ✅ A widget that updates every 10 minutes with:
- Random motivational messages
- Random background colors
- ✅ Clean, well-commented Swift code (great for learning!)
- ✅ Preview support for small, medium, and large widgets
- ✅ No App Groups required — beginner-safe
🧑💻 After downloading the project, follow these simple steps to run it.
- Open the
.xcodeproj
or.xcworkspace
file in Xcode 16.2 or later. - Step 2: Replace Team and Bundle Identifier
- Change Team: Select your Apple Developer Team from the dropdown.
- Change Bundle Identifier: Replace
com.yourname.WidgetApp
with your own unique Bundle ID (e.g.,com.johndoe.WidgetApp
). - Do the same for the widget target (e.g.,
com.johndoe.WidgetApp.widget
). - Press Shift + Command + K to clean the build and Run the app (Your App Must be selected as a target, not widget)
A tutorial to this source code can be found here: https://medium.com/app-makers/create-your-first-swiftui-widget-comprehensive-step-by-step-tutorial-cdca3b523bc9
❗ Keep In Mind before Purchasing :
This tutorial contains a simple basic example of a SwiftUI widget using WidgetKit
with StaticConfiguration
and a simple TimelineProvider
. It is intended for educational purposes only.
- The widget displays static or locally generated data only
- No integration with app logic, databases, or App Groups
- Only a widget extension is included — the main app is not implemented
- No advanced features like AppIntents, SwiftData, or configuration support
- This project will not receive future updates or maintenance
- You need to have Mac and Xcode 16.2 And Higher to run this file
- This code was created and tested on June 9, 2025 in Xcode 16.2, iOS 18.2. We are not responsible for any non-functional code in the future if changes are made to the ecosystem or Xcode.
Xcode project that demonstrates how to build a basic SwiftUI widget ( .zip file with a WidgetsTutorial.xcodeproj )