MijoCoder

CoreData without xcdatamodeld

CoreData model can be created programmatically with NSManagedObjectModel class.

Here is a project which demonstrates programmatic approach to CoreData: Github

The app shows a list of shelves (master) and list of books (detail).

Here the first commit is a classic approach using an xcdatamodeld file, and the second uses NSManagedObjectModel.

Before deleting an xcdatamodeld file, it’s helpful to create ManagedObject classes by opening the xcdatamodeld file and selecting Editor > Create NSManagedObject Subclass…

But why delete xcdatamodeld? I had to use ‘cmake’ and couldn’t find a way to generate an Xcode project with an xcdatamodeld file.

Tagged with: