Updating PhotoFilterViewController to save photos

The code that enables PhotoFilterViewController to save photos is similar to the code you implemented in ReviewFormViewController for saving reviews. You will now update PhotoFilterViewController to save photos when the Save button is tapped. Do the following steps:

  1. Click PhotoFilterViewController.swift in the Project navigator, and add the following method inside the private extension:
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: ...

Get iOS 13 Programming for Beginners - Fourth 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.