Skip to content

Instantly share code, notes, and snippets.

@izotx
Last active January 4, 2016 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save izotx/8581454 to your computer and use it in GitHub Desktop.
Save izotx/8581454 to your computer and use it in GitHub Desktop.
#import <FFEF/FatFractal.h>
@interface MyFractal : FatFractal
@end
@interface FatFractal()
- (void) setValuesOnObject:(id)obj fromDict:(NSDictionary *)dict loadFromCacheOnly:(BOOL)loadFromCacheOnly
doAutoLoadRefs:(BOOL)doAutoLoadRefs doAutoLoadBlobs:(BOOL)doAutoLoadBlobs;
@end
@implementation MyFractal
+(id)setValuesOnObject:(id)obj fromDict:(NSDictionary *)dict
{
return nil;
}
- (BOOL) shouldSerialize:(NSString *)propertyName;{
NSLog(@"%@",propertyName);
return YES;
}
- (id) createInstanceOfClass:(Class) class {
BOOL special = NO;
// if (Some code to figure out whether this class needs special initialisation or not)
// special = YES;
//
if([class isSubclassOfClass:[MFStudent class]])
{
NSManagedObjectContext *context = [(MFAppDelegate *) [[UIApplication sharedApplication]delegate]managedObjectContext];
//
NSEntityDescription *entityDescription = [NSEntityDescription entityForName:@"MFStudent" inManagedObjectContext:context];
MFStudent *user = [[MFStudent alloc]initWithEntity:entityDescription insertIntoManagedObjectContext:nil];
return user;
}
if (special) {
// Do special stuff
return [[class alloc] init];
} else {
return [[class alloc] init]; // This is essential, otherwise bad bad stuff will happen
}
}
- (void) setValuesOnObject:(id)obj fromDict:(NSDictionary *)dict loadFromCacheOnly:(BOOL)loadFromCacheOnly
doAutoLoadRefs:(BOOL)doAutoLoadRefs doAutoLoadBlobs:(BOOL)doAutoLoadBlobs
{
NSLog(@" %@",dict);
BOOL k = NO;
if (k) {
// set the values on the object from the dictionary
} else {
[super setValuesOnObject:obj fromDict:dict loadFromCacheOnly:loadFromCacheOnly doAutoLoadRefs:doAutoLoadRefs doAutoLoadBlobs:doAutoLoadBlobs];
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment