Currently, I have a swipe action in my TableView to perform a custom action on swipe on the corresponding cell. However, I'd like to change how far I have to drag to get the default haptic feedback to indicate completion of swipe. Also, I would like to add a feature that hides the swipe action automatically if the action is not completed instead of it remaining on screen. Here's my code so far:
override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let customRowAction = UIContextualAction(style: .normal, title: "Action") {(action, view, completed) -> Void in
//perform updates to data
completed(true)
}
let configuration = UISwipeActionsConfiguration(actions: [customRowAction])
return configuration
}
I'd like to achieve an effect similar to that of the Apollo reddit app. Any help would be appreciated!