Skip to content

Instantly share code, notes, and snippets.

@SkymanOne
Created July 18, 2019 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SkymanOne/7f4b8ab6ed614c310364b7a7963ebca4 to your computer and use it in GitHub Desktop.
Save SkymanOne/7f4b8ab6ed614c310364b7a7963ebca4 to your computer and use it in GitHub Desktop.
test
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