Repository pattern using Core Data and Swift

Repository pattern using Core Data and Swift

Core Data is a framework that is included in the iOS SDK that helps developers persist their model objects into an object graph.

[…]

Often it's a good idea to separate your domain models from your storage models. Your domain models should not be concerned with any aspect of how the data is stored in Core Data. Maybe at some point, you want to break a model into smaller models because you need to improve the Core Data query performance, maybe you want to drop Core Data and use Realm. Nonetheless, the domain layer should not interact with NSManagedObjects directly.

[…]