4

In Apple's 2014 WWDC keynote, they showed a gesture in the Mail app that lets you long-swipe to delete a message immediately. This is different than swiping then tapping the delete button. Below is a screen shot of it in action. Does anyone know if this is available as a public API yet? I've looked through the WWDC session videos and the documentation to no avail.

I would prefer to use native APIs rather than custom classes if possible; this is why I'm asking.

Thanks in advance.

enter image description here

mklbtz
  • 773
  • 7
  • 17
  • 1
    It's a custom control. You can implement it yourself using a scrollview, or use an open source that gives you similar results. – Léo Natan Sep 20 '14 at 19:46
  • 2
    The API that Apple uses for the mail app is private. People have implemented similar ones (though I always feel that Apple's look much better). Not sure why they keep it private to be honest. – erdekhayser Sep 20 '14 at 19:52
  • Unfortunately, it appears that Apple has not made this behavior available to developers. I ended up deciding against the swipe gesture for my app, but if you're still interested I played around with a few custom cells and [this one](https://github.com/alikaragoz/MCSwipeTableViewCell) looks the best to me. – mklbtz Oct 07 '14 at 14:38
  • look at this http://stackoverflow.com/a/26956300/362310 – Vaibhav Saran Dec 15 '15 at 07:48

2 Answers2

0

I found that it wasn't possible with a standard tableview, you have to implement it yourself with custom table view cells.

There are a number of libraries that do this, I found MGSwipeTableCell to be the best - it has a demo app which replicates the behavior of iOS 8 mail and is a good example.

Orion Edwards
  • 121,657
  • 64
  • 239
  • 328
0

As of iOS 11, there is finally a formal way to do this using the UIKit APIs. They're called "swipe actions" now, and they can be "leading" or "trailing" and even include an image. The UITableViewDelegate method is called leadingSwipeActionsConfigurationForRowAt. I learned about this from Use Yiur Loaf

mklbtz
  • 773
  • 7
  • 17