aashish nagar
aashish nagar

Reputation: 5

Dismiss UISwipeActionsConfiguration on reloading the table

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.

Upvotes: 0

Views: 264

Answers (1)

Abhishek
Abhishek

Reputation: 329

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)
}

Upvotes: 0

Related Questions