title: Swift: Deleting a row in a TableView (Core Data)
body: <p>Evening ladies and gentleman,
  I got a little problem with my TableView. I am using the code provided down below to delete a row in my tableview. But somehow the app crashes when I execute the delete swipe. The tableview uses core data. Does anyone of you know how to solve this?</p>
  
  <pre><code>override func tableView(_ tableView: UITableView,
                 trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -&gt; UISwipeActionsConfiguration?
  {
  
      let deleteAction = UIContextualAction(style: .destructive, title:  "Delete", handler: { (ac:UIContextualAction, view:UIView, success:(Bool) -&gt; Void) in
  
  
          tableView.deleteRows(at: [indexPath], with: .fade)
          CoreDataManager.shared.safeContext()
  
          print("Löschen")
          success(true)
      })
      deleteAction.image = UIImage(named: "trash1")
      deleteAction.backgroundColor = .red
  
      return UISwipeActionsConfiguration(actions: [deleteAction])
  }
  </code></pre>