CoreDataEvolution
This library is designed to simplify and enhance Core Data’s handling of multithreading, drawing inspiration from SwiftData’s
@ModelActorfeature, 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 aUnownedJob-based serial executor path compatible with the minimum supported OS versions.@NSModelActor Macro
The@NSModelActormacro simplifies Core Data concurrency, mirroring SwiftData’s@ModelActormacro. 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
NSMainModelActoris the main-thread companion macro for classes. It bindsmodelContexttoviewContextand provides the same convenience access APIs (subscript,withContext) throughNSMainModelActorprotocol 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: