Question: As illustrated, what I need to achieve is when swiping left, a button with an image shows up, the blue one, and when swiping right the green button shows up, how to do this? i use swift and xcode 6.4

This is what i tried before asking, I was able to show two options with text in the right of a cell, but i don't want that, what is needed is in the illustration, and as said, the buttons need to be images not text.

[![enter image description here](https://i.stack.imgur.com/A1T7C.png)](https://i.stack.imgur.com/A1T7C.png)

Answer: 
There are many ways to go at this, you could look into one of the many existing libraries such as BMXSwipeableCell by Massimiliano Bigatti <https://github.com/mbigatti/BMXSwipableCell>, where you can either look at the source code or copy it completely.

Another approach is reading through one of the following two great tutorials:

**How to Make a Swipeable TableViewCell With Actions - Without Going Nuts ScrollViews** - by Ellen Shapiro:
<https://www.raywenderlich.com/62435/make-swipeable-table-view-cell-actions-without-going-nuts-scroll-views>

**How to Make a Gesture-Driven To-Do List App Like Clear in Swift** - by Audrey Tam: <https://www.raywenderlich.com/77974/making-a-gesture-driven-to-do-list-app-like-clear-in-swift-part-1>

To give you a quick idea, the gist is as follows:

i. Create a custom `TableViewCell`

ii. Add a `UIPangestureRecognizer`

iii. Keep a reference to the original `contentView` frame, this is necessary since you will be swiping(panning) this `contentView` left and right. And keep a reference to the originalCenter of the cell. 

iv. Add the images, buttons, or other views you want to reveal to the cell 

What happens is that you will guide the appearance of your swipeable cell through the three stages of the `UIPanGestureRecognizer`: `UIGestureStateBegan, UIGestureStateChanged, UIGestureStateEnded`

1. `UIGestureStateBegan`: First check if this a horizontal pan, and not a vertical one in the `UIGestureDelegate`. We do this to not confuse the UITableView which, as you might recall scroll Vertically. Then get a reference to the original Center of the cell.
2. `UIGestureStateChanged`: As a user moves his finger to the left or to the right, we need to update the appearance of the cell. By moving the cell's `contentView's` center using the original center reference, and the movement given to us by the gesture we get exactly the behavior we wish to achieve.
3. `UIGestureStateEnded`: Here we need to decide if we want to keep the revealed image, button etc. in view after the user releases the cell, or if we want to 'snap' back. The threshold for this is really up to to, but will be some sort of percentage change left or right compared to the total width of the cell. If you wish to 'snap' back, simply set the `contentView`'s frame to the original frame we kept a reference to. If not, set it to an offset that nicely displays the content you wished to reveal.

I hope this helped in getting the concept across, please check out one of those two amazing tutorials for a more detailed explanation!
If you want to use library for such function, i would suggest you to use 
<https://github.com/MortimerGoro/MGSwipeTableCell> ...

its easy to use and easy customise.