I've got a problem to strikethrough over the row text while swiping (E.G. left).
I'm using the tableview method leadingSwipeActionsConfigurationForRowAt
, but I can't find the solution to strikethrough text while swiping.
As of now, the "swiped" row actually gets deleted.
What I'm looking to do:
Code:
override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let complete = completeAction(at: indexPath)
return UISwipeActionsConfiguration(actions: [complete])
}
func completeAction(at indexPath: IndexPath) -> UIContextualAction {
let action = UIContextualAction(style: .destructive, title: "Complete") { (action, view, completion) in
self.kind.remove(at: indexPath.row)
self.tableView.deleteRows(at: [indexPath], with: .fade)
completion(true)
if let context = (UIApplication.shared.delegate as? AppDelegate)?.coreDataStack.persistentContainer.viewContext {
let objectToDelete = self.fetchResultsController.object(at: indexPath)
context.delete(objectToDelete)
do {
try context.save()
} catch {
print(error.localizedDescription)
}
}
}
return action
}