SwiftData Essential Training
3h 19mIntermediate2024-03-28
Authors

Steven Lipton
VP of Special Projects at Scientific Device Laboratory, Developer
Course details
SwiftData allows you to handle persistent data quickly and easily in your applications. In this course, instructor Steven Lipton provides a comprehensive introduction on how to leverage this powerful framework built for Swift and SwiftUI.
Learn how to build models and apply those models in SwiftUI code, testing out your skills in the exercise challenges at the end of each section as you go. Steven covers the basics of filtering and sorting, common data issues, child tables, and attributes and settings. Along the way, you’ll find out how to create, customize, and work with model containers and migrate data like a pro.
Learn how to build models and apply those models in SwiftUI code, testing out your skills in the exercise challenges at the end of each section as you go. Steven covers the basics of filtering and sorting, common data issues, child tables, and attributes and settings. Along the way, you’ll find out how to create, customize, and work with model containers and migrate data like a pro.
Skills covered
SwiftAppleProgramming LanguagesSoftware DevelopmentOne-Off
Concepts
0. Introduction
- 01 - Persistence in SwiftUI apps
- 02 - What you need to know
- 03 - Observable objects
- 04 - What are schemas
1. SwiftData Basics
- 05 - Create a template project
- 06 - Add a model
- 07 - Add models to views
- 08 - Insert data
- 09 - Run and test the app
- 10 - Delete data
- 11 - Challenge - The names model
- 12 - Solution - The names model
2. Filtering and Sorting
- 13 - Useful array methods
- 14 - Define predicates
- 15 - Sort data
- 16 - Fetch data
- 17 - Dynamic data fetches
- 18 - Challenge - Sort and search names
- 19 - Solution - Sort and search names
3. Data Issues
- 20 - Codable in SwiftData
- 21 - Indexed tables
- 22 - Set up orderItem
- 23 - Subviews and SwiftData
- 24 - Transient data
- 25 - Challenge - Ratings
- 26 - Solution - Ratings
4. Child Tables
- 27 - One-to-many relationships
- 28 - Persistence of relations
- 29 - Keep model contexts together
- 30 - Primary keys
- 31 - Primary key error
- 32 - Editing error
- 33 - Challenge 4
- 34 - Solution 4
5. Attributes and Settings
- 35 - Cascading deletions
- 36 - Upserts
- 37 - Save rows
- 38 - Autosave
- 39 - Rollbacks
6. Model Containers
- 40 - Add SwiftUI previews
- 41 - Model configurations
- 42 - Custom model containers
- 43 - Modify model context
7. Data Migration
- 44 - Versioning schemas
- 45 - Configure versions
- 46 - Add migration plan
- 47 - Lightweight migration
- 48 - Add a column
Conclusion
- 49 - Next steps