I have implemented iOS 11 trailingSwipeActionsConfigurationForRowAt
and leadingSwipeActionsConfigurationForRowAt
for my UITableViewCell. I'm using trailingSwipeActionsConfigurationForRowAt
to disable the row, and leadingSwipeActionsConfigurationForRowAt
to undo the disable of the row. I've tried to use canEditRowAt
, but this disables editing of the entire row. Is there a way to disable only one of the swipe actions instead of disabling the entire row from editing?
I want to disable the undo swipe action if I already swiped to undo, but enable the cancel swipe action. I also want to disable the cancel swipe action if I already swiped to cancel, but enable the undo swipe action.
Try to return the empty array of actions in trailingSwipeActionsConfigurationForRowAt
method to disable one sided action.
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let swipeAction = UISwipeActionsConfiguration(actions: [])
return swipeAction
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With