title: Swift - TableView Assert Error: cellForRowAtIndexPath Because of: canEditRowAt()
body: <p>Using the following code:</p>
  <pre><code>override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -&gt; Bool {
      switch viewControllerCanEdit {
      case .viewControllerThatCanNotEdit:
          return false
      default:
          tableView.cellForRow(at: indexPath)?.reuseIdentifier == &quot;CellThatAllowsEditing&quot; else { return false }
          return true
      }
  }
  </code></pre>
  <p>I'm getting the following Assertion Error:</p>
  <blockquote>
  <p>[Assert] Attempted to call -cellForRowAtIndexPath: on the table view
  while it was in the process of updating its visible cells, which is
  not allowed. Make a symbolic breakpoint at
  UITableViewAlertForCellForRowAtIndexPathAccessDuringUpdate to catch
  this in the debugger and see what caused this to occur. Perhaps you
  are trying to ask the table view for a cell from inside a table view
  callback about a specific row? Table view: &lt;UITableView:
  0x7fd48303ec00; frame = (0 0; 414 896); clipsToBounds = YES;
  autoresize = W+H; gestureRecognizers = &lt;NSArray: 0x60000284e070&gt;;
  layer = &lt;CALayer: 0x60000264f340&gt;; contentOffset: {0, -100};
  contentSize: {414, 2765.3333333333335}; adjustedContentInset: {100, 0,
  83, 0}; dataSource: &lt;TableViewController:
  0x7fd48281b000&gt;&gt;</p>
  </blockquote>
  <p>I've narrowed down the cause. Supposedly this error is a result of the tableView calling <code>canEditRowAt()</code> while it's in the process of updating the data. And because of that, the call to match the <code>tableView.cellForRow(at:)</code> doesn't yet exist.</p>
  <p><strong>My question</strong> is; Is there a way to break out of the function if the tableView is updating? Or if there is a better way of trying to match if the cell can be edited based on the cells type?</p>