Skip to content

Commit d046194

Browse files
committed
Clear up app delegate in persistance demo.
1 parent c311bf6 commit d046194

File tree

1 file changed

+3
-31
lines changed

1 file changed

+3
-31
lines changed

PeristenceDemo/PeristenceDemo/AppDelegate.swift

+3-31
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
//
2-
// AppDelegate.swift
3-
// PeristenceDemo
4-
//
5-
// Created by Ben Sandofsky on 3/14/15.
6-
// Copyright (c) 2015 CodePath. All rights reserved.
7-
//
8-
91
import UIKit
102
import CoreData
113

@@ -23,27 +15,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2315
return true
2416
}
2517

26-
func applicationWillResignActive(application: UIApplication) {
27-
28-
}
29-
3018
func applicationDidEnterBackground(application: UIApplication) {
3119
self.saveToDisk()
3220
}
3321

34-
func applicationWillEnterForeground(application: UIApplication) {
35-
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
36-
}
37-
38-
func applicationDidBecomeActive(application: UIApplication) {
39-
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
40-
}
41-
42-
func applicationWillTerminate(application: UIApplication) {
43-
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
44-
}
45-
46-
4722
private func itemsFromDisk() -> [TodoItem] {
4823
return Array()
4924
}
@@ -53,21 +28,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
5328
}
5429

5530
private var pathForKeyedArchive:String {
56-
get {
57-
return (NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first! as NSString).stringByAppendingPathComponent("archive.bin")
58-
}
31+
return (NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first! as NSString).stringByAppendingPathComponent("archive.bin")
5932
}
6033

6134
// MARK: Core Data Stack
35+
var persistentStoreCoordinator:NSPersistentStoreCoordinator!
36+
var managedObjectContext:NSManagedObjectContext!
6237
private var pathForCoreDataStore:String {
6338
get {
6439
return (NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first! as NSString).stringByAppendingPathComponent("archive.sqlite")
6540
}
6641
}
6742

68-
var persistentStoreCoordinator:NSPersistentStoreCoordinator!
69-
var managedObjectContext:NSManagedObjectContext!
70-
7143
private func setupCoreDataStack(){
7244
let modelURL = NSBundle.mainBundle().URLForResource("Model", withExtension: "momd")!
7345
let model = NSManagedObjectModel(contentsOfURL: modelURL)!

0 commit comments

Comments
 (0)