title: How to properly adjust the movement of cells in the table
body: <p>The user's task is to arrange the cells in order. (for example a child)</p>
  <p><a href="https://i.stack.imgur.com/PFHfV.png" rel="nofollow noreferrer">Image</a></p>
  <p>move cells using:</p>
  <pre><code>    override func viewDidLoad() {
      super.viewDidLoad()
      ...
      table.dragDelegate = self
      table.dropDelegate = self
      table.dragInteractionEnabled = true
      ...
  }
  
  func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -&gt; Bool {
      return true
  }
  func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
      usersChooseOrder.insert(usersChooseOrder.remove(at: sourceIndexPath.row), at: destinationIndexPath.row)
  }
      
  func tableView(_ tableView: UITableView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -&gt; [UIDragItem] {
      print(&quot;itemsForBeginning&quot;)
      return []
  }
      
  func tableView(_ tableView: UITableView, performDropWith coordinator: UITableViewDropCoordinator) {
      print(&quot;  coordinator&quot;)
  }
  </code></pre>
  <p>At any time, you can check the correctness of the placement by pressing the &quot;Finish&quot; button and the correct cells, which in their place are colored green.
  Tell me in which direction to look to implement the following:</p>
  <p>the green cell should be fixed in place and not move anymore, neither with your finger, nor due to the movement of other cells. Those. if 5 is moved to place 2 under 4, then 2 should go to place 6, and 4 should remain in place.
  And if we move 5 to place 6, then 6 and 1 rise above and 5 is obtained above 4.</p>
  <p>I would be glad to any hint.</p>
  <p>Thank you!</p>