title: Swift - Drag And Drop TableViewCell with Long Gesture Recognizer
body: <p>So I have seen a lot of posts about reordering cells that pertain to using "edit mode", but none for the problem I have. (Excuse me if I am wrong).</p>
  
  <p>I am building a ranking app, and looking for a way to use a long gesture recognizer to reorder the cells in my UITableView. Essentially a user will be able to reorder and "Rank" the cells full of strings in a group with their friends.</p>
  
  <p>I would go the standard route of using an "edit" bar button item in the nav bar, but I am using the top right of the nav bar for adding new strings to the tableview already. (The following image depicts what I mean).</p>
  
  <p>So far, I have added `</p>
  
  <pre><code>    var lpgr = UILongPressGestureRecognizer(target: self, action: "longPressDetected:")
  
      lpgr.minimumPressDuration = 1.0;
      tableView.addGestureRecognizer(lpgr)`
  </code></pre>
  
  <p>to my viewDidLoad method, and started creating the following function:</p>
  
  <pre><code>    func longPressDetected(sender: AnyObject) {
  
      var longPress:UILongPressGestureRecognizer = sender as UILongPressGestureRecognizer
      var state:UIGestureRecognizerState = longPress.state
  
      let location:CGPoint = longPress.locationInView(self.tableView) as CGPoint
      var indexPath = self.tableView.indexPathForRowAtPoint(location)?
  
      var snapshot:UIView!
      var sourceIndexPath:NSIndexPath!
  
  }
  </code></pre>
  
  <p>All of the resources I have scowered for on the internet end up showing me a HUGE, LONG list of additives to that function in order to get the desired result, but those examples involve core data. It seems to me that there must be a far easier way to simply reorder tableview cells with a long press?</p>
  
  <p><img src="https://i.stack.imgur.com/EQ352.png" alt="enter image description here"></p>