Latest 0.5.0
Homepage https://github.com/tablelist/TLDataManager
License MIT
Platforms ios 6.0, requires ARC
Authors

Version
Platform

Usage

To run the example project; clone the repo, and run pod install from the Example directory first.

Static Singleton

The singleton is useful for managing a single CoreData stack for your application. For most applications, one CoreData stack is sufficient.

“`Objective-C:
[TLDataManager setDatabaseName:@"MY_DB_NAME" linkedToModel:@"MY_MODEL_NAME"];
[TLDataManager sharedManager];


#### Initialization

For applications that require multiple CoreData stacks, you can initalize your own TLDataManager instance.

```Objective-C:
// create the manager
TLDataManager *manager = [[TLDataManager alloc] initWithDatabaseName:@"MY_DB_NAME" 
                                                       linkedToModel:@"MY_MODEL_NAME"];

// do something with the main context
[manager.mainContext ...]

Import Data

Importing data on a background thread is easy if you follow a few simple rules.

“`Objective-C:
// reference the manager
TLDataManager *manager = [TLDataManager sharedManager];

// import data and pass in block to be executed on a background thread
// there is a reference to a background context that should be used for importing data
[manager importData:^(NSManagedObjectContext *context){

// perform long import
NSCustomManagedObject *object = [NSCustomManagedObject longImportInContext:context];

// return block to be called on main thread
return ^{
    // reference main context
    NSManagedObjectContext *mainContext = manager.mainContext;
    // reference imported object(s) on main thread
    NSCustomManagedObject *newObject = [context objectWithID:object.objectID];
    // ... callback with newObject on main thread ...
}

}];



## Requirements

iOS 6.1 or later

## Installation

TLDataManager is available through [CocoaPods](http://cocoapods.org), to install
it simply add the following line to your Podfile:

    pod "TLDataManager"

## Author

Andrew Barba, [email protected]

## License

TLDataManager is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "TLDataManager",
    "version": "0.5.0",
    "summary": "A robust object that manages a single CoreData stack.",
    "description": "                       The `TLDataManager` manages a single CoreData stack consisting of one mastern                       `NSManagedObjectContext` on a private thread, one main `NSManagedObjectContext` onn                       the main thread, and one background `NSManagedObjectContext`'s on background a thread.n",
    "homepage": "https://github.com/tablelist/TLDataManager",
    "license": "MIT",
    "authors": {
        "Andrew Barba": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tablelist/TLDataManager.git",
        "tag": "0.5.0"
    },
    "platforms": {
        "ios": "6.0"
    },
    "requires_arc": true,
    "source_files": "Classes",
    "public_header_files": "Classes/*.h"
}

Pin It on Pinterest

Share This