As it mentioned by you guys:
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
lazy var coreDataStack = CoreDataStack(modelName: "SurfJournalModel")
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
_ = coreDataStack.mainContext
guard let navigationController = window?.rootViewController as? UINavigationController,
let listViewController = navigationController.topViewController as? JournalListViewController else {
fatalError("Application Storyboard mis-configuration")
}
listViewController.coreDataStack = coreDataStack
return true
}
func applicationWillTerminate(_ application: UIApplication) {
coreDataStack.saveContext()
}
}
Isn’t keyword lazy excessive??? because CoredataStack already reference type it won’t copy as value type