My root ViewController
is called MainViewController
.
It has a subview called ToolsViewController
.
I want to reference the subview (ToolsViewController
) from my AppDelegate.
I can reference the root view, however, I cannot seem to get to the subview. I have tried the following in didFinishLaunchingWithOptions
:
if let vc = window?.rootViewController as? MainViewController {
if let toolsVC = vc.childViewControllers.first as? ToolsViewController {
toolsVC.modelController = ModelController()
}
}
Again, I can reference the root ViewController
, but my reference to the subview is not working at all.
Thanks!