I am following a tutorial online regarding a TableView Cell swipe action.
override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let like = UIContextualAction(style: .normal, title: "Like") { (_, _, isComplete) in
self.favStatusCollection[indexPath.row] = !self.favStatusCollection[indexPath.row]
// Call completion handler to dismiss the action button
isComplete(true)
}
However, if I call isComplete(false) instead of isComplete(true). It makes no difference in action in the running test.
The header doc of `UIContextualActionHandler` (in UIContextualAction.h) says:
pass YES to the completionHandler if the action was actually performed, to show a visual indication of the successful completion
But, as far as I tested, I cannot find any visual indications when returnning true, compared to returning false.
(I found some articles saying that some early versions of iOS 11 showed different behavior, but that was considered to be a bug and fixed.)
iOS might be using the value internally (or may use it in the future), so you should better pass the appropriate value:
true: for the action actually performed, false: otherwise
even if it makes no difference.