Вам нужно всего лишь
self.listOfCoins.remove(at: indexPath.row)
self.tableView.deleteRows(at: [indexPath], with: .automatic)
Так удалите это
let delete = deleteAction(at: indexPath)
tableView.reloadData() // remove this line
И
self.tableView.deleteRows(at: [indexPath], with: .automatic)
self.tableView.reloadData() // remove this line
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let delete = deleteAction(at: indexPath)
print(listOfCoins)
print(listOfCoins.count)
return UISwipeActionsConfiguration(actions: [delete])
}
func deleteAction(at indexPath: IndexPath) -> UIContextualAction {
let action = UIContextualAction(style: .destructive, title: "Delete") { (action, view, nil) in
self.listOfCoins.remove(at: indexPath.row)
self.tableView.deleteRows(at: [indexPath], with: .automatic)
}
action.title = "Delete"
action.backgroundColor = .red
return action
}