Created
July 18, 2019 13:39
-
-
Save SkymanOne/7f4b8ab6ed614c310364b7a7963ebca4 to your computer and use it in GitHub Desktop.
test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { | |
let task: Task = tasks[indexPath.row] | |
let action: UIContextualAction = UIContextualAction(style: .destructive, title: "Finish", handler: { | |
(action, view, completionHandler) in | |
self.tasks.remove(at: indexPath.row) | |
tableView.deleteRows(at: [indexPath], with: .fade) | |
completionHandler(true) | |
}) | |
action.backgroundColor = .red | |
let config = UISwipeActionsConfiguration(actions: [action]) | |
return config | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment