Wednesday, March 11, 2026

CoreDataEvolution

Fatbobman (Mastoson):

This library is designed to simplify and enhance Core Data’s handling of multithreading, drawing inspiration from SwiftData’s @ModelActor feature, enabling efficient, safe, and scalable operations.

[…]

  • Custom Executors for Core Data Actors
    CoreDataEvolution provides custom executors that ensure all operations on managed objects are performed on the appropriate thread associated with their managed object context. It uses a UnownedJob-based serial executor path compatible with the minimum supported OS versions.

  • @NSModelActor Macro
    The @NSModelActor macro simplifies Core Data concurrency, mirroring SwiftData’s @ModelActor macro. It generates the necessary boilerplate code to manage a Core Data stack within an actor, ensuring safe and efficient access to managed objects.

  • NSMainModelActor Macro
    NSMainModelActor is the main-thread companion macro for classes. It binds modelContext to viewContext and provides the same convenience access APIs (subscript, withContext) through NSMainModelActor protocol extensions.

  • Elegant Actor-based Concurrency
    CoreDataEvolution allows you to create actors with custom executors tied to Core Data contexts, ensuring that all operations within the actor are executed serially on the context’s thread.

Previously:

Update (2026-03-19): Fatbobman:

More precisely, it’s my own answer to these disconnects: If I still value Core Data’s object graph model, its migration system, and its mature runtime capabilities, can I make it continue to exist in modern Swift projects in a more natural way?

[…]

But in the era of cloud sync, Core Data projects often encounter two other very real needs: how to handle continuously changing transaction histories, and how to monitor iCloud / CloudKit’s operational status.

To that end, I’ve also built two complementary tools: PersistentHistoryTrackingKit and iCloudSyncStatusKit.

Comments RSS · Twitter · Mastodon

Leave a Comment