Загрузка...

How to Build a Widget in SwiftUI with WidgetKit for iOS & macOS

Widgets boost app engagement by putting your app’s content right on the iOS Home Screen and macOS Desktop. 🚀

In this SwiftUI Widgets Masterclass (2025), we’ll build a modern cross-platform widget from scratch using WidgetKit in SwiftUI.

🤔You’ll learn how to:
✅ Set up a Widget Extension in Xcode
✅ Build widgets for multiple sizes (small, medium)
✅ Customize widget UI with SwiftUI
✅ Add support for both iOS & macOS

By the end, you’ll know the complete flow for creating widgets that look great and update seamlessly across platforms.

🔗 Apple WidgetKit Documentation: https://developer.apple.com/documentation/widgetkit

🖼 Try It Yourself!
Clone or download the full demo project here:
📁 Demo Template: https://github.com/NDCSwift/CatFactsWidgets

🔗 Helpful Links
📘 Apple Docs – SwiftUI Menu: https://developer.apple.com/documentation/swiftui/menu

⏱️Timestamps
00:00 - Intro & App Example
00:51 - Project Creation
02:46 - Adding a Widget in Xcode
04:01 - Widget Scheme & Template
06:15 - Creating Our Timeline Entry
07:22 - Sharing Data & App Groups
09:55 - Timeline Provider
13:34 - Rendering the Widget
18:00 - Widget Configuration
20:31 - Supporting Widget Sizes
21:58 - Completion
22:20 - Widget Bundle & Supporting Multiple Widgets
22:59 - Testing iOS Widget
24:14 - Testing MacOS Widget
25:38 - Recap & Wrap up

Видео How to Build a Widget in SwiftUI with WidgetKit for iOS & macOS канала Noah Does Coding
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять