Latest | 0.2.2 |
---|---|
Homepage | https://github.com/buhikon/JLCoreDataHelper |
License | MIT |
Platforms | ios 6.0, requires ARC |
Authors |
[](https://travis-ci.org/Joey L./JLCoreDataHelper)
Installation
JLCoreDataHelper is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod "JLCoreDataHelper"
Before Start
- Create Data Model file. (.xcdatamodeld)
- Set entities and attributes as you wish.
- Perform below code at the beginning of app starts.
application:didFinishLaunchingWithOptions:
method is recommended for this.#import <JLCoreDataHelper/JLCoreDataHelper.h> - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [JLCoreDataHelper initializeWithDataModelName:@"Data Model file name here" saveFolderName:@"folder name"]; }
- It’s possible to set a store type to a specific entity like below:
[JLCoreDataHelper setStoreType:JLCoreDataStoreTypeMemory forEntity:@"Entity Name"];
Usage
use below public methods to manage data.
#pragma mark -get
- (NSMutableArray *)getObjectsWithEntity:(NSString *)entityName;
- (NSMutableArray *)getObjectsWithCondition:(NSString *)condition
entity:(NSString *)entityName;
- (NSMutableArray *)getObjectsWithCondition:(NSString *)condition
sortingKeys:(NSArray *)skeys
entity:(NSString *)entityName;
- (NSMutableArray *)getObjectsWithCondition:(NSString *)condition
sortingKeys:(NSArray *)skeys
ascending:(BOOL)ascending
entity:(NSString *)entityName;
#pragma mark -set, update
- (id)set:(NSDictionary *)keyValue condition:(NSString *)condition entityName:(NSString *)entityName;
- (void)update:(NSDictionary *)keyValue condition:(NSString *)condition entityName:(NSString *)entityName;
#pragma mark -create
- (id)create:(NSDictionary *)newValue entityName:(NSString *)entityName;
- (id)createWithoutSaving:(NSDictionary *)newValue entityName:(NSString *)entityName;
- (id)createForEntityName:(NSString *)entityName initBlock:(void(^)(id newObject))initBlock;
#pragma mark -delete
- (BOOL)deleteObject:(id)object;
- (void)deleteAllObjectsForEntityName:(NSString *)entityName;
License
JLCoreDataHelper is available under the MIT license. See the LICENSE file for more info.
Latest podspec
{ "name": "JLCoreDataHelper", "version": "0.2.2", "summary": "A helper class for CoreData.", "description": "A helper class for CoreData. It hides original methods for CoreData, and make it easy to manage data.", "homepage": "https://github.com/buhikon/JLCoreDataHelper", "license": "MIT", "authors": { "Joey L.": "[email protected]" }, "source": { "git": "https://github.com/buhikon/JLCoreDataHelper.git", "tag": "0.2.2" }, "platforms": { "ios": "6.0" }, "requires_arc": true, "source_files": "Pod/Classes/**/*", "resource_bundles": { "JLCoreDataHelper": [ "Pod/Assets/*.png" ] } }
Fri, 04 Mar 2016 09:58:04 +0000