Updating the PhotoFilterViewController class to save photos
The code that enables the PhotoFilterViewController
class to save photos to the persistent store is similar to the code you implemented in the ReviewFormViewController
class for saving reviews. You will now update the PhotoFilterViewController
class to save photos when the Save button is tapped. Follow these steps:
- Click the
PhotoFilterViewController
file in the Project navigator. Add the following method inside theprivate
extension after theinitialize()
method:func saveSelectedPhoto() { if let mainImage = self.mainImageView.image { var restPhotoItem = RestaurantPhotoItem() restPhotoItem.date = Date() restPhotoItem.photo = mainImage.preparingThumbnail(of: CGSize(width: 100, height...