title: Error when deleting item from tableview in swift
body: <p>I am trying to implement a delete functionality in my app allowing users to delete information stored in core data and presented through a table view.</p>
  
  <p>here is my code:</p>
  
  <pre><code> func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
      if (editingStyle == .Delete){
  
  
      tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic) //error on this line
  
          }
  }
  </code></pre>
  
  <p>the error is as follows:</p>
  
  <pre><code>Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-3318.16.14/UITableView.m:1582
  Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0.  The number of rows contained in an existing section after the update (6) must be equal to the number of rows contained in that section before the update (6), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'
  </code></pre>
  
  <p><br>
  What am I doing wrong? How do I fix this error?</p>