Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dismiss UISwipeActionsConfiguration by swiping back

I implemented trailing swipe actions using new iOS 11 UISwipeActionsConfiguration API, and I can reveal them by swiping from the edge, can swipe all the way to the left side etc.

But I can't hide those actions by swiping back to original position. If I drag a little bit to the left and then back to the right it does dismiss (see gif). It also gets dismissed by tapping on a cell.

The official Mail app does support dragging to hide swipe actions, so there may be a way in the API too.

See sample project here: https://github.com/nezhyborets/ios-case-study-playgrounds/tree/master/UISwipeActionsConfiguration

enter image description here

like image 746
Oleksii Nezhyborets Avatar asked Apr 02 '18 21:04

Oleksii Nezhyborets


1 Answers

let delete = UIContextualAction(style: .destructive, title: "Delete") { (myContext, myView, complete) in

//Did what you wanted to do
complete(true)

//Cancelled the action
complete(false)

}

like image 77
Aleksey Mazurenko Avatar answered Oct 17 '22 16:10

Aleksey Mazurenko