-
Notifications
You must be signed in to change notification settings - Fork 5
Getting Started
kevindelord edited this page Jun 28, 2016
·
7 revisions
At every app start, the CoreData stack needs to be initialised.
Setup, and reset if needed, the datamodel using an auto migrating system.
A good practice will be to call this method at the beginning of the application:application didFinishLaunchingWithOptions:launchOptions method of your AppDelegate.
The database filename will be generated from the app bundle identifier.
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
DKDBManager.setup()
return true
}
Function to clean up the CoreData stack, the defaults contexts and error handlers.
func applicationWillTerminate(application: UIApplication) {
DKDBManager.cleanUp()
}
You could also subclass the DKDBManager and wrap the functions in a dedicated class.