0

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 Answers1

0

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)
}
Abhishek
  • 329
  • 3
  • 12