RestKit is compatible to MagicalRecord, however it requires some sort of hack to get it working:
See: RKMagicalRecord / RKMRAppDelegate.m @ L15-L18
// Use a class extension to expose access to MagicalRecord's private setter methods @interface NSManagedObjectContext () + (void)MR_setRootSavingContext:(NSManagedObjectContext *)context; + (void)MR_setDefaultContext:(NSManagedObjectContext *)moc; @end
So they're using a somewhat hacky approach to acces the private MR_setRootSavingContext
method.
I know that in swift I can define extensions, but then I have to implement them, how can I achieve the same workaround in swift.
Or more generally, how can I setup Magical Record to use the NSManagedObjectContext
created by RestKit.
Simply (not good maybe) it's create a bridge file
and add there
@interface NSManagedObjectContext ()
+ (void)MR_setRootSavingContext:(NSManagedObjectContext *)context;
+ (void)MR_setDefaultContext:(NSManagedObjectContext *)moc;
@end
Here example for create a bridged file http://ios-blog.co.uk/tutorials/how-to-create-an-objective-c-bridging-header/