Skip to content
This repository was archived by the owner on Apr 3, 2020. It is now read-only.

Memrise/SLCoreDataStack

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SLCoreDataStack

SLCoreDataStack provides a CoreData stack managing two NSManagedObjectContext's for you:

  • -[SLCoreDataStack backgroundThreadManagedObjectContext] with NSPrivateQueueConcurrencyType: Perform any changes to any CoreData model you are making here with the -[NSManagedObjectContext performBlock:] API.
  • -[SLCoreDataStack mainThreadManagedObjectContext] with NSMainQueueConcurrencyType: Use this context for displaying models to the UI.
  • SLCoreDataStack keeps these contexts is sync by automatically merging changes between them.
  • SLCoreDataStack supports automatic database migrations. For example: If you have three different model versions, then you can provide one migration from version 1 to version 2 and one migration from version 2 to version 3. SLCoreDataStack will find and detect available migrations and migrate an existing database under the hood for you.

Check out this blog post on why we chose this NSManagedObjectContext concept.

Getting started

Subclass SLCoreDataStack and implement managedObjectModelName:

@interface GHDataStoreManager : SLCoreDataStack

@end

@implementation GHDataStoreManager

- (NSString *)managedObjectModelName
{
    return @"GithubAPI";
}

@end

You are good to go now :)

License

MIT

About

CoreData stack managing independent 2 NSManagedObjectContext instances

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 98.0%
  • Ruby 2.0%