Core Data Migrations: Can we do Better?
summary
Shows how Core Data actually migrates: demonstrates a simple lightweight migrations rename, a type-change solved by a custom NSMigrationPolicy transform method, and splitting an attribute into a new entity by overriding createDestinationInstances and tracking created countries to avoid duplicates. Explains manual progressive migration paths between multiple model versions, how to locate or supply an NSMappingModel, and contrasts the work with a schema-free alternative using JSON document storage such as Couchbase Mobile.
AI-written summary · about
chapters (24)
- 0:00Intro
- 2:22Core Data Stack: ios10
- 2:47Managed Object Model
- 3:09Schema Changes
- 3:58Option 1: Delete the app and reinstall
- 4:31Option 2: Core Data Migrations
- 6:33Lightweight Migrations
- 7:16Configure Core Data Stack
- 7:34Some help from editor
- 7:58Case 2
- 9:15Define Custom Mapping
- 10:32Case 3
- 11:50Custom Migration Policy (3/3)
- 15:14Manual
- 16:37Testif Migration is Needed
- 17:06Migrate Stores Progressively
- 17:57Identity Model compatible with Store
- 18:14Migrate Store from src to dst model
- 18:43Find Mapping Model
- 19:16NoSQL Option for Persisting Data
- 21:30Data Modeling
- 22:39JSON to Native Mapping
- 23:54Couchbase Lite
- 25:02Resources
related talks
41mUsing Core Data in a Modern SwiftUI Application
41mSyncing and Collaboration with CloudKit
45mMoving from Objective-C to Swift — Is It Really That Simple?
01h 13mMigrating to React Native: A long-term retrospective
49mIs There an ORM Better Than SwiftData?
22mCore ML and Your App
37mWriting Swift, while living on Objective-C
53mRefactor Your Way Forward
