Wrapping Up ImageStore

Now that the ImageStore can store images and instances of Item have a key to get an image (Figure 15.14), you need to teach DetailViewController how to grab the image for the selected Item and place it in its imageView.

The DetailViewController’s view will appear when the user taps a row in ItemsViewController and when the UIImagePickerController is dismissed. In both of these situations, the imageView should be populated with the image of the Item being displayed. Currently, it is only happening when the UIImagePickerController is dismissed.

In DetailViewController.swift, make this happen in viewWillAppear(_:).

override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) nameField.text ...

Get iOS Programming: The Big Nerd Ranch Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.