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 ...