I am trying to init my core data stack with the init VC of my app. To do this I want to pass the core data manager i have created into the first VC upon loading. 

I thought this code would make sense to pass the coredatamanager into the VC, however I get errors whichever way i write this code, im sure im missing something simple?

```
        // Initialize Storyboard
    let storyboard = UIStoryboard(name: "RoutineController", bundle: Bundle.main)

    // Instantiate Initial View Controller
    if let viewController = storyboard.instantiateInitialViewController() as? ViewController {
        // Configure View Controller
        viewController.coreDataManager = coreDataManager

        // Set Root View Controller
        window?.rootViewController = viewController
    }

```

Error is simply:

> 
> Use of undeclared type 'ViewController'
> 
> 
> 

However if i delete 'as? ViewController' I get an error on the following line that viewController has no property coreDataManager. 

Is there some sort of delegate i need to define in the viewdidload of the view controller in sending to?

**EDIT** Revised my code to correct the storyboard ID, however the code inside the {} doesnt seem to execute, i get the printed error i wrote due to the if let failing, so this still isnt the right way to set the viewController...any ideas as to why?

```
        // Initialize Storyboard
    let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)

    // Instantiate Initial View Controller
    if let viewController = storyboard.instantiateInitialViewController() as? RoutineController {

        // Configure View Controller
        print("SENDING THIS INFO TO THE FIRST VC \(self.coreDataManager)")
        viewController.coreDataManager = self.coreDataManager
        // Set Root View Controller
        window?.rootViewController = viewController
    } else {
        print("WE COULDNT SET VIEWCONTROLLER AS THE DESIGNATED VC SO MOC WASNT PASSED")
    }

```