Next add the action method for gesture recognizer. It should start by getting the location of the long press in the table view, and find the corresponding index path for the cell at that location. Remember the index path might be nil (for example, if the user taps and holds on a section header of the table view).

Next you’ll handle the UIGestureRecognizerStateBegan case. If there is a valid (non-nil) index path, get the corresponding UITableViewCell and take a snapshot view of the table view cell using a helper method. Then add the new snapshot view to the table view and center it on the corresponding cell.

For a better user experience and a more natural effect fade out the original cell, fade in the snapshot view, make the snapshot view slightly bigger, and offset its Y coordinate to align with gesture’s location Y. This way it appears as if the cell is popped out of the table view, floating over it and snapped to user’s finger.

As gesture moves (the UIGestureRecognizerStateChanged case), move the snapshot view by offsetting its Y coordinate only. If the gesture moves enough that its location corresponds to a different index path, tell the table view to move the rows. At the same time, you should update your data source too:

How to use this with UICollectionView?

Assuming you have already a sample project that uses UICollectionView, you can easily adopt the above code for that project. All you have to do is replacing self.tableView with self.collectionView and updating calls to get and move UICollectionViewCell.