Media
SwiftData Basics Tutorial: How to Easily Persist Data in SwiftUI
In this SwiftData tutorial, I share the basics of SwiftData, a new data persistence framework introduced during WWDC 2023.

In this SwiftData tutorial, I share the basics of SwiftData, a new data persistence framework introduced during WWDC 2023. SwiftData allows you to store and manage data on your device and even use iCloud sync to share data between different devices. I explain how to use SwiftData with SwiftUI in Xcode 15 beta 5 and highlight some of its advantages.
I start by showing you how to create a new project in Xcode 15 and choose SwiftData as the storage option. I then walk you through the process of creating a basic example using SwiftData, including defining model files, generating a schema, and working with the model context.
Next, I demonstrate how to insert, update, and delete data using SwiftData. I also show you how to use bindings to easily update properties in your data model.
Additionally, I cover sorting and filtering data with SwiftData, allowing you to customize the display of your data based on specific criteria.
Throughout the video, I provide tips and insights into working with SwiftData, including potential issues and limitations to be aware of.
