Programmatically using CoreData
by Thizzer

Apple’s CoreData provides an easy-to-use mechanism to store data and objects in your iOS and OSX Apps. Using the .xcdatamodeld file you can predefine your model and using that you can generate NSManagedObject subclasses to allow easy interaction with your database. CoreData also allows for versioning of your datamodel so that you have to do the least manual conversion possible when making changes to it.


But there is another way to do this. Programmatically. This means we are not defining the datamodel in the .xcdatamodeld file but in our code.


In this article I will explain how to programatically create and manage CoreData storage in Objective-C. Later I will also try to add a Swift variant.