title: How to update the tableview row after swipe action?
body: <p>I am using swipe actions in my tableview. I want to add and delete small icons on the row after a swipe action completed.</p>
  <p>I use an asynchronous thread to do this but, it is not giving a smooth result as I wanted. My code is given below any help will be appriciated.</p>
  <pre><code>func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -&gt; UISwipeActionsConfiguration? {
      let groceryAction = groceryToggleAction(forRowAtIndexPath: indexPath)
      let config = UISwipeActionsConfiguration(actions: [groceryAction])
      return config
  }
  
  func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -&gt; UISwipeActionsConfiguration? {
      let consumeAction = consumeToggleAction(forRowAtIndexPath: indexPath)
      let config = UISwipeActionsConfiguration(actions: [consumeAction])
      return config
  }
  
  // MARK: Custom Methods
  func groceryToggleAction(forRowAtIndexPath indexPath: IndexPath) -&gt; UIContextualAction {
      let food = foods[indexPath.item]
      let action = UIContextualAction(style: .normal, title: &quot;actionTitle&quot;) { (action, view, completionHandler) in
  
          let food = self.foods[indexPath.item]
  
          food.isAddedToGrocery = !food.isAddedToGrocery
          self.persistenceManager.saveContext()
          DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) {
              self.homeTableView.reloadRows(at: [indexPath], with: .none)
          }
          completionHandler(true)
      }
      action.image = #imageLiteral(resourceName: &quot;shoppingCart&quot;) // İyi bir liste ikonu bul...
      action.backgroundColor = food.isAddedToGrocery ? UIColor.Palette.alizarin : UIColor.Palette.turquoise
      action.title = food.isAddedToGrocery ? &quot;Remove&quot; : &quot;Add&quot;
      return action
  }
  
  func consumeToggleAction(forRowAtIndexPath indexPath: IndexPath) -&gt; UIContextualAction {
      let food = foods[indexPath.item]
  
      let action = UIContextualAction(style: .normal, title: &quot;actionTitle&quot;) { (action, view, completionHandler) in
  
          food.isConsumed = !food.isConsumed
          self.persistenceManager.saveContext()
          DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) {
              self.homeTableView.reloadRows(at: [indexPath], with: .none)
          }
          completionHandler(true)
  
      }
      action.image = #imageLiteral(resourceName: &quot;pacman&quot;)
      action.title = food.isConsumed ? &quot;Remove&quot;: &quot;Consumed!&quot;
      action.backgroundColor = food.isConsumed ? UIColor.Palette.alizarin : UIColor.Palette.turquoise
      return action
  }
  </code></pre>