title: How to dismiss swipe action context menu on cancel
body: <p>I've added a swipe to delete functionality with the use of </p>
  
  <pre><code>override func tableView(_ tableView: UITableView, 
          trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) 
           -&gt; UISwipeActionsConfiguration?
  </code></pre>
  
  <p>I'm calling an alert with dismiss/confirm actions. Once dismissed I want to dismiss the swipe action menu.</p>
  
  <pre><code>    override func tableView(_ tableView: UITableView,
                              trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -&gt; UISwipeActionsConfiguration? {
  
          let deleteClosure:UIContextualAction.Handler = {
              (action:UIContextualAction,
              view:UIView,
              completionHandler:(Bool) -&gt; Void) in
              let alert = self.confirmDeletion({ _ in
  
                  let row = indexPath.row;
                  let removed = self.logList.remove(at: row);
                  self.deleteLogEntry(removed);
                  //
                  tableView.reloadData();
                  //
  
              }, declineBlock: {_ in
                  tableView.reloadData();// this hides it but w/o animation
              });
              DispatchQueue.main.async {
                  self.present(alert, animated: true, completion: nil);
              }
          }
          let deleteAction = UIContextualAction(style: .destructive, title: "Delete", handler: deleteClosure);
  
          return UISwipeActionsConfiguration(actions: [deleteAction]);
      }
  </code></pre>
  
  <p>So far I've found that reloading table data will close the trailing swipe menu but w/o animation which looks odd. Is there a way to tell it to dismiss with an animation?</p>
  
  <p>** Note about duplicate **
  Marked as duplicate to the question that refers to dismiss not working as expected AFTER row was deleted, it is not the case here. I want to dismiss trailing swipe when user cancels deleting and row is NOT removed.</p>
  
  <hr>
  
  <p>What I've already tried:</p>
  
  <ul>
  <li><code>tableView.setEditing(false, animated: true);</code> - no visible difference</li>
  <li><code>tableView.reloadRows(at: [indexPath], with: UITableView.RowAnimation.automatic);</code> - row was moved right with animation but the button was overlapping</li>
  <li><code>tableView.resignFirstResponder();</code> - no visible difference (I had to try)</li>
  <li><code>tableView.reloadTable()</code> - swipe menu IS dismissed but w/o animation effect</li>
  </ul>