April 2020
Intermediate to advanced
528 pages
15h 40m
English
The DetailViewController needs an instance of ImageStore to fetch and store images. You will inject this dependency into the DetailViewController’s designated initializer, just as you did for ItemsViewController and ItemStore in Chapter 9.
In DetailViewController.swift, add a property for an ImageStore.
Listing 15.11 Adding an ImageStore property to the detail view controller (DetailViewController.swift)
var item: Item! {
didSet {
navigationItem.title = item.name
}
}
var imageStore: ImageStore!
Now do the same in ItemsViewController.swift.
Listing 15.12 Adding an ImageStore property to the items view controller (ItemsViewController.swift)
var itemStore: ItemStore! ...
Read now
Unlock full access