Last active
May 6, 2020 16:21
-
-
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
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, 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]) | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To swipe left delete action:
Go to Swipe Left with Images