Group Group Group Group Group Group Group Group Group

Chapter 5 - photoPicker and copy(contentsOf: entry) bugs

I came accross a couple of errors in chapter 5; here’s how I fixed them:

  1. p87 - photoPicker object doesn’t exist in the base project starting from previous chapters. Fixed by copying PhotoPicker.swift from the ‘Util’ folder from the chapter 5 starting project into my project from the previous chapters and adding it to MainTableViewController.

  2. p92 - copy(contentsOf: entry) crashes the app if the entry.log string is empty (as it is for all new entries). I fixed this by putting it inside an if let statement so that it’s only copied to the clipboard if the string != nil.