swiftdata

Installation
Summary

Define, persist, and query structured data in iOS 26+ apps with SwiftData and Swift 6.2.

  • Model definition with @Model classes, @Attribute, @Relationship, @Transient, @Unique, and @Index decorators; supported types include primitives, Date, Data, URL, UUID, Codable enums/structs, and relationships
  • CRUD operations via ModelContext with @Query for reactive SwiftUI views, #Predicate for type-safe filtering, and FetchDescriptor for advanced queries with sorting, limits, and prefetching
  • Schema versioning and migration using VersionedSchema and SchemaMigrationPlan for lightweight or custom data transformations
  • Concurrency support via @ModelActor for background work; pass PersistentIdentifier across actor boundaries, never model objects directly
  • CloudKit sync configuration through ModelConfiguration and coexistence or migration paths from Core Data
Related skills

More from dpearson2699/swift-ios-skills

Installs
1.5K
GitHub Stars
562
First Seen
Mar 3, 2026