I need to turn on a tableView editing mode by clicking on one of its cells from swipe action "move":
Code for swipe action:
override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let move = UIContextualAction(style: .normal, title: "Переместить") { (action, view, completionHandler) in
self.turnEditing()
completionHandler(true)
}
move.backgroundColor = UIColor(named: "CalmBlueColor")
let configuration = UISwipeActionsConfiguration(actions: [move])
return configuration
}
turnEditing() function:
func turnEditing() {
if tableView.isEditing {
tableView.isEditing = false
} else {
tableView.isEditing = true
}
}
When I press on the swipe actions it's just closes, without going to editing mode... Here is the GIF: https://cln.sh/ilEN9F
Is it possible to go into editing mode from a swipe action or only from a barButtonItem + IBAction?