Our backend API returns an object that I don't want to store in my local CoreData instance. This object contains nested objects, however, which I do want to store in the database.
I implemented this using two mappings:
- A
RKObjectMappingthat maps my regular, non-NSManagedObjectA. - A
RKEntityMappingmapping for my NSManagedObjectB.
Then I connected both by adding the following to A's mapping:
mappingA.addPropertyMapping(
RKRelationshipMapping(fromKeyPath: "b",
toKeyPath: "b",
withMapping: B.mapping()
)
)
As it seemed to work fine, I never questioned this approach. But now I'm not so sure if this configuration is actually supported by RestKit.
So, can you mix RKEntityMappings and RKObjectMappings in RestKit like above?