What problem does it solve?
This Skill helps you implement, review, or improve data persistence in your iOS applications using SwiftData, ensuring your app's data is managed efficiently and reliably.
Core Features & Use Cases
- Model Definition: Define your data models using the
@Model macro, specifying attributes, relationships, and transient properties.
- Data Persistence: Set up
ModelContainer for your app's data store, including configurations for CloudKit sync or in-memory storage for previews.
- CRUD Operations: Perform Create, Read, Update, and Delete operations on your data using
ModelContext and FetchDescriptor.
- Querying: Leverage
@Query and #Predicate for powerful, declarative data fetching directly in SwiftUI views.
- Schema Migration: Handle database schema evolution gracefully with
VersionedSchema and SchemaMigrationPlan.
- Concurrency: Manage data operations safely in background threads using
@ModelActor.
Quick Start
Use the swiftdata skill to define a new @Model class named 'Task' with properties 'title' (String) and 'isCompleted' (Bool).