Skip to content

Instantly share code, notes, and snippets.

@jimbrayrcp
Last active May 6, 2020 16:21
Show Gist options
  • Select an option

  • Save jimbrayrcp/97febfda4bf62e5df0b6abfd71460a06 to your computer and use it in GitHub Desktop.

Select an option

Save jimbrayrcp/97febfda4bf62e5df0b6abfd71460a06 to your computer and use it in GitHub Desktop.
Swift 5: iOS: 13.1 - tableView Swipe Right Delete (or any function you want to add) Uses system images
func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let action = UIContextualAction(style: .normal, title: "", handler: { (ac:UIContextualAction, view:UIView, success:(Bool) -> Void) in
// *** add object To be deleted ***
// object.delete
success(true)
})
action.image = UIImage(systemName: "trash.fill")
action.backgroundColor = .green
return UISwipeActionsConfiguration(actions: [action])
}
@jimbrayrcp

jimbrayrcp commented May 6, 2020

Copy link
Copy Markdown
Author

To swipe left delete action:
Go to Swipe Left with Images

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment