Dismiss UISwipeActionsConfiguration on reloading the table

263 Views Asked by At

When user swipe the cell I m showing some option. Everything is working fine, When user scroll the table swipe option goes off. I want the same behaviour when I reload the table on data change. How to achieve that. If user has swipe the cell and I reload table , Swipe options are still there.

1

There are 1 best solutions below

0
Abhishek On BEST ANSWER

You hide the swiped cell just add this line of code before reloading the table view.

tableView.setEditing(false, animated: true)

Now for enabling the editing, In your cellForAtIndex Path function make a check like

if indexPath.row == array.size {
   tableView.setEditing(true, animated: true)
}