I have swipeable tableview cells. The intention is to let the user swipe rows left or right completely (swipe out completely), and the swiped row gets removed from the table (like how Inbox by Gmail works). Everything works fine, but I had a question.
func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let swipeRightAction = UIContextualAction(style: .destructive, title: "", handler: { (ac:UIContextualAction, view:UIView, success:(Bool) -> Void) in
let item = self.myItems[indexPath.row]
self.swipeRight(item) //do something
self.myItems.remove(at: indexPath.row)
success(true)
})
return UISwipeActionsConfiguration(actions: [swipeRightAction])
}
How can I set the threshold/distance (how much the user has to swipe before the action is taken)? Currently, the user has to swipe half way, before the row gets swiped out. Can I change this point so the user only needs to swipe a little (say 20% of the way) to swipe out the row?
