title: Deleting from Core Data Swift 4
body: <p>I have a Favorites button that when clicked will add the image of the particular character to CoreData.</p>
  
  <pre><code>@IBAction func favButtonClicked(_ sender: UIButton) {
      if sender.isSelected != true {
          saveFav()
      }     
  }   
  
  func saveFav() {
  
      let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
      let newFav = NSEntityDescription.insertNewObject(forEntityName: "Favorite", into: context)
      newFav.setValue((figure?.image)!, forKey: "favFig")
  
      do {
          try context.save()
          print("Saved!")
      } catch {
          //Process Error
      }
  }
  </code></pre>
  
  <p>My question is how do I remove that image from CoreData when clicking the button again?</p>