ALManagedObjectFactory
This pod is abandoned
This pod is abandoned and its code is merged into ALCoreDataManager.
Usage
Import to your pch file
#import <ALManagedObjectFactory/ALManagedObjectFactory.h>
Use singleton to get a factory
#import <ALManagedObjectFactory/ALManagedObjectFactory+Singleton.h>
// get factory
[ALManagedObjectFactory defaultFactory];
For each entity create a category on ALManagedObjectFactory. Lets say there is a Tag entity, which has a Title. Then you should create category 'ALManagedObjectFactory+CreateTag' and implement:
@implementation ALManagedObjectFactory (CreateTag)
- (Tag*)createTagWithTitle:(NSString*)title
{
Tag *product = (Tag*)[self createObjectForEntityClass:[Tag class]];
// // or you can use
// Tag *product = (Tag*)[self createObjectForEntityName:@"Tag"];
product.title = title;
return product;
}
@end
Requirements
If you are using the singleton also install ALCoreDataManager and configure it in your AppDelegate before any call to ALManagedObjectFactory.
Installation
ALManagedObjectFactory is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "ALManagedObjectFactory"
Author
Aziz U. Latypov, vm06lau@mail.ru
License
ALManagedObjectFactory is available under the MIT license. See the LICENSE file for more info.