Swipe Actions for Custom UIView


I have a custom UIView that I would like to add swipe actions to.
The swipe actions I am looking for are the swipes that can be added to a UITableViewCell such as the leading and trailing swipes that are shown in the Apple Mail app.
However, the user will need to swipe a UIView instead of a Table Cell in the app I am building.
I am not completely sure how to go about creating the same action for a UIView.
Does anyone have any suggestions on how to go about this?

Thank you!


With UIKit you can call trailing or leading methods:

  func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { }

Then just add a UIContextualAction that will segue to the new View.

Good luck.