TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jan 2015 |
Maintained by Marco Sero.
Core Data (and iCloud) made nimble and fast.
The answer is quite easy. I needed a Core Data wrapper with these features:
and then import Nimble.h
into your prefix file.
First, set up the local or cloud store based on what you need
[NimbleStore nb_setupStore:&error];
// OR
[NimbleStore nb_setup_iCloudStore:&error]
The iCloud set up, thanks to iOS 7's API is natively completely asynchronous and a local store is created ready to use waiting for the iCloud's one.
At this moment, iCloud is available for iOS 7 only as it is not good enough in iOS 6.
Easily save in main or background thread, everything is then merged into the main context
[NimbleStore nb_saveInBackground:^(NBContextType contextType) {
Book *book = [Book nb_createInContextOfType:contextType];
book.name = @"Best book ever";
}];
You can create a new object with
[YourModelObject nb_createInContextOfType:NBMainContext];
to create an object and in the same time initialize some of its property, you can just use
[YourModelObject nb_createInContextOfType:NBMainContext initializingPropertiesWithDictionary:@{
@"name" : @"Marco" ,
@"surname" : @"Sero"
}];
You can find all type of finders and fetchers in NSManagedObject+Finders.h
For example, to fetch and change an object in background you can just do:
[NimbleStore nb_saveInBackground:^(NBContextType contextType) {
Book *book = [Book nb_findFirstInContext:contextType];
book.name = @"updated name";
}];
It just needs some love from you guys as it has never been tested on a real app. After that, here's my list:
nb_
prefixMarco Sero
Nimble is available under the MIT license. See the file LICENSE.