How to Preview SwiftUI & SwiftData App on Xcode Canvas | Sample Data for SwiftUI Previews - 4/9
Автор: Think Like an Engineer
Загружено: 2025-02-03
Просмотров: 227
Описание:
Learn How to Use Sample Data for Previews in Xcode!
In this video, we’ll show you how to effortlessly preview your SwiftUI views in Xcode without manually adding sample data each time. We’ll create a SampleData class that provides sample data for your previews with just one line of code, no more losing data when the canvas refreshes!
What You’ll Learn:
✅ How to create a SampleData class for previews
✅ How to use an in-memory model container for sample data
✅ How to automatically insert sample data into previews
✅ How to simplify your preview setup in SwiftUI
Related Videos:
📌 • How to Insert Data with SwiftData & SwiftU...
📌 • How to Query Data with SwiftData | Get All...
📌 • How to Navigate between Views using Naviga...
Chapters:
00:00 Introduction
00:22 Quick Recap of the Sample Project
01:52 Create Sample Data Class
05:23 Provide Sample Data to the List View
06:06 Provide Sample Data to the Detail View
07:01 How to Update Sample Data Class if Required
07:15 Showcase
🔔 If you found this tutorial helpful, don’t forget to subscribe and leave a comment below, what you would like to learn next!
#Xcode #preview #SwiftUI #SwiftData #canvas
Повторяем попытку...

Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: