Latest 1.1.0
Homepage https://github.com/nunobaldaia/NBCoreDataController
License MIT
Platforms ios 7.0, osx 10.9, requires ARC
Frameworks Foundation, CoreData
Authors

NBCoreDataController is a simple and lightweight implementatoin of the elegant three-context scheme proposed by Marcus Zarra for asynchronous CoreData saving, as documented by Cocoanetics.

Scheme

It provides a shared instance with a CoreData stack for the default SQLite database and model created by Xcode templates, and provides a simple API for saving data in the background.

[[NBCoreDataController sharedInstance] saveWithBlock:^(NSManagedObjectContext *localContext) {
    // Do the heavy work here
} completion:^(BOOL success, NSError *error) {
    // Do something on the main thread after the save has been completed
}];

It also provides helpful extensions to NSManagedObject for fetching and manipulating objects on any context.

Problems

Since all changes flow from temporary background contexts through the main context up to the root (writing) context, the main context can suffer a degrade in performance for intensive writing. Also, reading from the root context will be locked while it is writing data.

For intensive reading/writing apps, or if you need something more configurable and complete, take a look into the popular MagicalRecord.

For regular data IO, this is a pretty simple architecture that’s working fine on production for Listary.

Latest podspec

{
    "name": "NBCoreDataController",
    "version": "1.1.0",
    "summary": "Simple and lightweight three-layer CoreData stack for asynchronous saving",
    "description": "NBCoreDataController is a simple and lightweight implementatoin of the elegantnthree-context scheme proposed by [Marcus Zarra](http://www.cimgf.com) nfor asynchronous CoreData saving, as [documented by Cocoanetics](http://www.cocoanetics.com/2012/07/multi-context-coredata/).",
    "homepage": "https://github.com/nunobaldaia/NBCoreDataController",
    "license": "MIT",
    "authors": {
        "Nuno Baldaia": "[email protected]"
    },
    "social_media_url": "http://twitter.com/nunobaldaia",
    "source": {
        "git": "https://github.com/nunobaldaia/NBCoreDataController.git",
        "tag": "1.1.0"
    },
    "source_files": "NBCoreDataController",
    "frameworks": [
        "Foundation",
        "CoreData"
    ],
    "requires_arc": true,
    "platforms": {
        "ios": "7.0",
        "osx": "10.9"
    }
}

Pin It on Pinterest

Share This