Saving photos 

Saving reviews was pretty simple, and is virtually no different to saving photos. Our code will be pretty similar to what we had for reviews. Open PhotoFilterViewController and update it with the following:

func checkSavedPhoto() {     if let img = self.imgExample.image {         var item = RestaurantPhotoItem()             item.photo = generate(image: img, ratio: CGFloat(102))             item.date = NSDate() as Date             item.restaurantID = selectedRestaurantID                  let manager = CoreDataManager()         manager.addPhoto(item)         dismiss(animated: true, completion: nil)     }}

This method will make sure that we have an image and that we can save it to Core Data with its restaurant ID. We need to add a method for when Save is tapped. Add the following method inside the private ...

Get iOS 12 Programming for Beginners - Third 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.