Project Audit (Core Data)
Project Audit (Core Data)
Section titled “Project Audit (Core Data)”Use this checklist to quickly discover how a project uses Core Data and which constraints apply (platform availability, CloudKit, history tracking, etc.).
Determine platform constraints
Section titled “Determine platform constraints”- Find the deployment target (iOS/macOS version). Many recommendations depend on this (e.g. staged migration and composite attributes require iOS 17+/macOS 14+).
- Note whether the project is Swift 6 / strict concurrency enabled (Sendable and isolation warnings change the advice).
Inspect the data model
Section titled “Inspect the data model”- Open the model XML (
*.xcdatamodeld/*/contents) and check:- entities, attributes, relationships, constraints
- versioning setup (multiple model versions)
- renaming identifiers (for lightweight migration)
- composite attributes (iOS 17+)
Identify stack setup
Section titled “Identify stack setup”Search for:
NSPersistentContainervsNSPersistentCloudKitContainerloadPersistentStoresconfigurationpersistentStoreDescriptions(migration options, history tracking, CloudKit options)viewContextconfiguration (merge policy,automaticallyMergesChangesFromParent, query generations)- background context creation (
newBackgroundContext,performBackgroundTask)
Then consult:
stack-setup.mdfor recommended defaults and merge policiescloudkit-integration.mdif CloudKit is enabled
Check for persistent history tracking (required for some flows)
Section titled “Check for persistent history tracking (required for some flows)”Search for:
NSPersistentHistoryTrackingKeyNSPersistentStoreRemoteChangeNotificationPostOptionKey- remote change notifications and history processing/merging
Then consult:
persistent-history.mdfor the Observer/Fetcher/Merger/Cleaner pattern
Spot risky concurrency patterns
Section titled “Spot risky concurrency patterns”Search for:
- cross-thread access to managed objects (look for passing
NSManagedObjectinto async tasks/closures) performAndWaitusage (risk of deadlocks / UI blocking)@unchecked Sendableapplied to Core Data types (usually hides a real problem)
Then consult:
threading.mdandconcurrency.md
Useful debugging flags (for repro builds only)
Section titled “Useful debugging flags (for repro builds only)”-com.apple.CoreData.ConcurrencyDebug 1(threading violations)-com.apple.CoreData.SQLDebug 1(SQL logging)