Mantle and core data: only one model

I am starting to use Core Data with my Mantle object (MTLModel) after this tutorial: http://chroman.me/core-data-and-mantle-one-to-many-relationship/

This article says:

Since model classes inherit from NSManagedObject, this means that they cannot inherit from MTLModel, we need to use separate classes for the mantle and kernel data

So, I have two classes with the same properties:

  • TrackMTL.m (MTLModel)
  • Track.m (NSManagedObject)

I am looking for an une-solution without having to create two models for the same object and without using a shell, such as Overcoat .

+4
source share
1 answer

You do not need to use 2 classes, just add this to your MTModel:

<MTLJSONSerializing, MTLManagedObjectSerializing>

and for the properties you must implement:

+ (NSDictionary *)managedObjectKeysByPropertyKey
+2
source

All Articles