Skip to content

Instantly share code, notes, and snippets.

@pgpt10
Last active November 2, 2017 12:10
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 pgpt10/ce43a3a802bbe85168331b342bae02c3 to your computer and use it in GitHub Desktop.
Save pgpt10/ce43a3a802bbe85168331b342bae02c3 to your computer and use it in GitHub Desktop.
@available(iOS 11.0, *)
func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration?
{
let deleteAction = UIContextualAction(style: .destructive, title: "Add") { (action, view, handler) in
print("Add Action Tapped")
}
deleteAction.backgroundColor = .green
let configuration = UISwipeActionsConfiguration(actions: [deleteAction])
return configuration
}
@available(iOS 11.0, *)
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration?
{
let deleteAction = UIContextualAction(style: .destructive, title: "Delete") { (action, view, handler) in
print("Delete Action Tapped")
}
deleteAction.backgroundColor = .red
let configuration = UISwipeActionsConfiguration(actions: [deleteAction])
return configuration
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment