title: ios application crashes when deleting line in uitableView
body: <p>I have a problem in my UITableView which filled with <code>data: [(gamme: String, [(product: String, quantity: Double)])]</code>, everything works fine: inserting rows and sections, deleting row and section, reloading. 
  But sometimes and when I try to delete lots of lines in fast way (line by line by swiping the line the table and tap (-) ). it leads to a crash like in the screenshot.</p>
  
  <p>The issue is hard to reproduce in development app. but my clients still reports it. My clients are professionals (not normal users) and are expected to use the in a fast way with medium to large data.</p>
  
  <p><a href="https://i.stack.imgur.com/VbeS9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VbeS9.png" alt="enter image description here"></a></p>
  
  <p>and this is my func that delete lines: </p>
  
  <pre><code>    override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -&gt; [UITableViewRowAction]? {
  
      let delete = UITableViewRowAction(style: .destructive, title: "-") { (action, indexPath) in
  
          let cmd = self.groupedData[indexPath.section].1.remove(at: indexPath.row)
          tableView.deleteRows(at: [indexPath], with: .right)
          self.delegate?.didDeleteCmdLine(cmd)
  
          if self.groupedData[indexPath.section].1.count == 0 {
              self.groupedData.remove(at: indexPath.section)
              tableView.deleteSections(IndexSet(integer: indexPath.section), with: UITableViewRowAnimation.right)
          }
      }
  
      return [delete]
  }
  </code></pre>
  
  <p>why is that happening ?</p>
  
  <p><em>This is a screen of xcode organiser for the crash</em></p>
  
  <p><a href="https://i.stack.imgur.com/8HfEM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8HfEM.png" alt="enter image description here"></a>
  <strong>Edit:</strong></p>
  
  <p>Checking if <code>groupedData</code> is accessed by any thread other than main proposed by @Reinhard:</p>
  
  <pre><code>private var xgroupedData = [(gamme: GammePrdCnsPrcpl, [cmdline])]()
  
  private var groupedData: [(gamme: GammePrdCnsPrcpl, [cmdline])] {
      get {
          if !Thread.isMainThread {
              fatalError("getting from not from main")
          }
          return xgroupedData
      }
      set {
          if !Thread.isMainThread {
              fatalError("setting from not from main")
          }
          xgroupedData = newValue
      }
  }
  </code></pre>
  
  <p>but the <code>groupedData</code> variable is accessed only from main thread</p>