title: attempt to insert row 3 into section 0, but there are only 3 rows in section 0 after the update
body: <p>There is strange thing with may tableView</p>
  
  <p>I have </p>
  
  <p>In my delegate I have</p>
  
  <pre><code>var editingIndexPath: IndexPath?
  
  func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
  
          if let editingIndexPath = editingIndexPath {
              return datasource.count + 1
          } else {
              return datasource.count
          }
  
      }
  </code></pre>
  
  <p>In my didSelect I have</p>
  
  <pre><code>    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  
              if let oldEditingIndexPath = editingIndexPath {
                      self.editingIndexPath = nil
                      tableView.reloadData()
                      self.editingIndexPath = IndexPath(row: indexPath.row + 1, section: 0)
                      tableView.insertRows(at: [self.editingIndexPath!], with: .top)
              } else {
                  editingIndexPath = IndexPath(row: indexPath.row + 1, section: 0)
                  if let editingIndexPath = editingIndexPath {
                      tableView.insertRows(at: [editingIndexPath], with: .top)
                  }
              }
      }
  </code></pre>
  
  <p>The problem that it crashes after tableView.reloadData() with error</p>
  
  <blockquote>
    <p>'attempt to insert row 3 into section 0, but there are only 3 rows in section 0 after the update'</p>
  </blockquote>
  
  <p>I dont get it. TableView has exactly same number of rows it needs to perform insert. I set property to nil and then reload table, by this action I reduce table's rows number to two. Then I again set <code>editingIndexPath</code> to not nil value signaling delegate method that it should use count + 1. But it fails same way.</p>
  
  <p>And what is also interesting that the same code but without reload before never fails</p>
  
  <pre><code>            editingIndexPath = IndexPath(row: indexPath.row + 1, section: 0)
              if let editingIndexPath = editingIndexPath {
                  tableView.insertRows(at: [editingIndexPath], with: .top)
              }
  </code></pre>
  
  <p>What's happening here ?</p>