#core data

7 posts with this tag

Progressive Core Data Migrations

February 04, 2019

There are very few certainties in app development, but one is that once your app is released it will change in unexpected ways. And no matter how flexible your architecture it is inevitably one of those changes will be a breaking change. Perhaps the most important breaking changes involve the user's data. If your app loses or corrupts user data you can expect at least some reputational damage and if the loss is severe enough you can end up doing your competitors marketing for them by turning your users into…

Can Unit Testing and Core Data become BFFs?

April 02, 2018

Core Data and Unit Testing haven't always been the best of friends. Like two members of the same friend group who don't really know each other but really like their UIKit friend, Core Data and Unit Testing have in fact discovered that they have a lot in common and have gradually got more and more friendly with each other. But before we delve into how they can take it one step further and become firm friends, we need to understand what makes each of them tick. Getting to know each other Core Data Core Da…

Step-by-step Core Data Migration

November 30, 2017

This post is now out-of-date, please instead see: "Progressive Core Data Migration". People really care about their possessions. Nowhere do you see this more than on public transport. It's not unusual to see bags occupying seats while people stand. As a Brit, we have developed a powerful non-verbal based form of communication to indicate that you want someone to move their bag - maybe a slight shuffle, eye contact with other standing commuters and tutting. Even with these clear signs some people…

Considering pages when caching a JSON response

March 27, 2016

Social networks work on the basis of presenting a feed and allowing the user to interact with the content contained in the feed in (hopefully) novel and interesting ways that the user derives usefulness (joy?) from. The presentation of the feed varies greatly from social network to social network but the underlaying model is often very similar to: The Feed being the set of the total information, if you are using a RESTful API this will often take the form of an endpoint url: https://greatsocialnetwork.co…

De-stringing entity descriptions

October 22, 2011

Application requirements evolve, which require us to refactor existing features. For the most part, Xcode's built-in refactoring tools work well; however, an area where the refactoring tools can't help is with stringy APIs. Core Data seems to be full of stringy method parameters - in this article I want to look at how we can de-stringify NSEntityDescription to allow for greater compile protection and super-charge Xcode's refactoring tools. Changing people to players If I have a Core Data entity called:…

Core Data terms

March 11, 2011

I'm often asked to explain Core Data to the new joiners. I thought I'd share what I tell them about the components that make up Core Data: Persistent store - is where Core Data stores its data, more often in a form of a SQLLite database but can be Atomic (binary store) or In-Memory. NSPersistentStoreCoordinator - controls access to the persistent store - save, retrieve and search. NSManagedObjectModel - representation of data model in memory, can combine multiple persistent stores into one. Represented by…