//
//  AppDelegate.swift
//  Habits
//
//  Created by Julian Grosshauser on 26/09/15.
//  Copyright © 2015 Julian Grosshauser. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow? = {
        let window = UIWindow(frame: UIScreen.mainScreen().bounds)
        window.backgroundColor = .whiteColor()
        return window
    }()

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        let habitsViewModel = HabitsViewModel()
        let habitsDataSource = HabitsDataSource(viewModel: habitsViewModel)
        let habitsController = HabitsController(viewModel: habitsViewModel, dataSource: habitsDataSource)
        let navigationController = UINavigationController(rootViewController: habitsController)

        window?.rootViewController = navigationController
        window?.makeKeyAndVisible()
        
        return true
    }
}

//
//  AppDelegate.swift
//  Habits
//
//  Created by Julian Grosshauser on 26/09/15.
//  Copyright © 2015 Julian Grosshauser. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow? = {
        let window = UIWindow(frame: UIScreen.mainScreen().bounds)
        window.backgroundColor = .whiteColor()
        return window
    }()

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        let navigationController = UINavigationController(rootViewController: HabitsController(viewModel: HabitsViewModel()))

        window?.rootViewController = navigationController
        window?.makeKeyAndVisible()
        
        return true
    }
}

--- 
+++ 
@@ -17,7 +17,10 @@
     }()
 
     func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
-        let navigationController = UINavigationController(rootViewController: HabitsController(viewModel: HabitsViewModel()))
+        let habitsViewModel = HabitsViewModel()
+        let habitsDataSource = HabitsDataSource(viewModel: habitsViewModel)
+        let habitsController = HabitsController(viewModel: habitsViewModel, dataSource: habitsDataSource)
+        let navigationController = UINavigationController(rootViewController: habitsController)
 
         window?.rootViewController = navigationController
         window?.makeKeyAndVisible()
Update initialization of root view controller
