SwiftData vs Core Data in Production: Migration, CloudKit & WAL Matrix
Choosing between SwiftData and Core Data is one of the highest-leverage architectural decisions in a new iOS app. Because SwiftData builds on top of the Core Data SQLite stack, both share underlying WAL (Write-Ahead Logging) mechanics — yet they differ sharply in migration ergonomics and predicate expressiveness.
Production Feature Comparison
| Capability | SwiftData | Core Data |
|---|---|---|
| Minimum OS Target | iOS 17+ (iOS 18+ for History/Indexes) | iOS 13+ (mature everywhere) |
| Schema Definition | Pure Swift @Model macro | .xcdatamodeld XML + generated classes |
| Complex Custom Migrations | SchemaMigrationPlan (strict ordering) | Full NSMigrationManager & mapping models |
| CloudKit Sync | Requires optional properties & no unique constraints | NSPersistentCloudKitContainer (battle-tested) |
| Background Batch Writes | @ModelActor isolated context | performBackgroundTask + NSBatchInsertRequest |
Safe Background Writes with @ModelActor
@ModelActor
actor SyncImporter {
func upsertItems(_ payloads: [ItemDTO]) throws {
for dto in payloads {
modelContext.insert(CachedItem(id: dto.id, title: dto.title))
}
try modelContext.save()
}
}
Always test schema upgrades against a real SQLite fixture exported from your previous App Store release before shipping (see Apple SwiftData Documentation).