I do not think it is possible using CoreData for this.
But if the passphrase, if you're looking, you can just use macros:
#define NULL_NIL(_O) _O != [NSNull null] ? _O : nil #define DICT_GET(_DICT, _KEY) NULL_NIL([_DICT objectForKey:_KEY]) #define DICT_GET_INT(_DICT, _KEY) [DICT_GET(_DICT, _KEY) intValue] ...
Not that I would say optimized, but brings concise and readable code:
- (void)deserialize:(NSDictionary *)dictionary { self.name = DICT_GET(dictionary, @"name"); }
source share