MMRecord 1.2.0

2013 was a great year for MMRecord. The library transformed from internal tool to successful open source project and has received some great feedback by many people using it in their applications. It continues to be widely used within Mutual Mobile for our projects that use Core Data. And its almost up to 400 stars on GitHub (w00t!).

I'm releasing a new version with a couple of new features and improvements. Please check them out below.

1) AFMMRecordResponseSerializer

The details of the AFMMRecordResponseSerializer are described in detail at the Mutual Mobile engineering blog, but in short, this is an extension to MMRecord and AFNetworking 2.0 to provide a response serializer that returns parsed and populated MMRecord objects in an AFNetworking success block. AFNetworking is a fantastic networking library and this extension makes it even easier to use MMRecord alongside it.

2) Orphan Deletion

Orphan deletion has been a long time coming. This is actually a very hard problem to solve in a generic way, but I think we have a good solution. The way it works is users of MMRecord can supply an orphan deletion block that will be called once per orphan that MMRecord detects. An orphan is defined as an object of a given entity type that exists in Core Data but was not returned by the API response that MMRecord just parsed. Instead of deleting all of these orphans categorically, MMRecord will call the orphan deletion block and allow the user to return YES or NO if it wants that orphan to be deleted or not. The block contains plenty of data to allow the user to make an informed decision. 

Advanced users will note that the NSManagedObjectContext is also passed into this block. This allows you to gain direct access to the context after population and before it gets saved - allowing you a very high level of control over the results of a parsing operation. With great power comes great responsibility, so think about your problem twice before resorting to context manipulation.

The new version also includes a subtle change to the MMRecordMarshaller class. The marshaller now exposes a new method called valueForAttribute:rawValue:dateFormatter:. This method is intended to be subclassed and can be used to more easily customize the way the marshaller formats data that gets populated on a record. Before you would have had essentially copy paste the contents of the original marshaller implementation into yours in order to do this, which is obviously not ideal. Hopefully this change will better address that need of some users.

Finally, I wanted to thank some of the community members who have been so generous of their time and thoughts in helping to make MMRecord better. Thanks very much!


Lars Anderson

Rene Cacheaux

Kevin Harwood

Swapnil Jadhav

John McIntosh

Luke Rhodes

Matt Weathers

Alex Woolf