Setting properties on the ItemsViewController instance

Hi. I have a problem with understanding the reason why we set properties for ItemsViewController instance in App Delegate but for DetailViewController we don’t do that. Can anybody explain what is the difference in these two cases?

Since the Detail View Controller is presented via segue from the Items View Controller, the setup is done in the Items View Controller. Because the App Delegate isn’t setting up the Details View Controller (since it doesn’t need to be presented at launch time), its properties aren’t set there.

It’s a combination of applying dependency injection (ref: Chapter 10) alongside the drill-down interface (ref: Chapter 14) afforded by the navigation controller.

We inject the lower-level objects (i.e. the ItemStore and ImageStore for the Items View Controller, and the Item for the Details View Controller) to the higher-level objects (i.e. the Item and Detail View Controller, respectively) before we present them on the screen.