Defining @Model Types
Annotate classes as persistent models.
Meet SwiftData
SwiftData is Apple's modern way to save app data right on the device. You describe your data once, and it handles storage for you. 💾
The @Model Macro
You turn a plain class into a saved type by adding the @Model macro above it. That one line makes every instance persistable.
@Model
class Task {
}All lessons in this course
- Defining @Model Types
- The Model Container & Context
- Querying with @Query
- Inserting, Updating & Deleting