Tag Archives: CoreData

Unit Testing Core Data NSManagedObject with Kiwi

      5 Comments on Unit Testing Core Data NSManagedObject with Kiwi

The project that I am working on at the moment utilises Core Data for storing data, and that meant that I would need to figure out how to unit test the model. Most of what you are going to need to do is validate that your managed objects come back with appropriate defaults when first allocated, and that bounds checking… Read more »

Adding Convenience Methods to NSFetchedResultsController via Categories

One really useful feature of Objective-C is the ability to extend an existing class without the need to sub-class via inheritance.  This means that existing code can stay in place whilst additional functionality is added for the convenience of future maintenance. Categories is the feature that makes this possible.  In effect, this says to the compiler, ‘add on these methods… Read more »

Revisiting the Core Data Singleton

      2 Comments on Revisiting the Core Data Singleton

Whilst I’m sure the idea of a Singleton for application wide variables is going to be good one, I must say that I’ve revisited this idea over the last couple of days, especially with the help of an article Core Data: Passing around a NSManagedObjectContext on the iPhone which helps to set the perspective (as it should be) to the… Read more »

Moving Core Data to the Singleton

      1 Comment on Moving Core Data to the Singleton

[UPDATE:] You might like to read Revisiting the Singleton to see how my opinion has changed on this. Now we’ve established the principle of using a Singleton as our main app coordinator, it would make more sense to move the Core Data functions there.  If you choose to add Core Data when generating from an XCode template, these function are… Read more »