title: How to delete item from collection view?
body: <p>I try to remove an item from a collection view based on a user's choice in an alert.</p>
  
  <p>I have the following code:</p>
  
  <pre><code>func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
      let person = people[indexPath.item]
  
      let questionController = UIAlertController(title: "What u wanna do?", message: nil, preferredStyle: .Alert)
      questionController.addAction(UIAlertAction(title: "Rename person", style: .Default, handler: {
  
          (action:UIAlertAction!) -&gt; Void in
  
          let ac = UIAlertController(title: "Rename person", message: nil, preferredStyle: .Alert)
          ac.addTextFieldWithConfigurationHandler(nil)
  
          ac.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: nil))
          ac.addAction(UIAlertAction(title: "OK", style: .Default) { [unowned self, ac] _ in
              let newName = ac.textFields![0] as! UITextField
              person.name = newName.text
  
              self.collectionView.reloadData() })
  
          self.presentViewController(ac, animated: true, completion: nil)
  
      }))
  
      questionController.addAction(UIAlertAction(title: "Delete Person", style: .Default, handler: {
  
          (action:UIAlertAction!) -&gt; Void in
  
          println("hello world")
          self.collectionView.deleteItemsAtIndexPaths([indexPath.item])
          self.collectionView.reloadData()
  
      }))
  
      presentViewController(questionController, animated: true, completion: nil)
  }
  </code></pre>
  
  <p>"hello world" works okay but the app crashes when I press "Delete Person".</p>
  
  <p>The console output is</p>
  
  <pre class="lang-none prettyprint-override"><code>hello world
  2015-07-18 13:40:14.628 Project10[15888:1274436] -[__NSCFNumber section]:         unrecognized selector sent to instance 0xb000000000000003
  2015-07-18 13:40:14.636 Project10[15888:1274436] *** Terminating app due to    uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber    section]: unrecognized selector sent to instance 0xb000000000000003'
  </code></pre>
  
  <p>What am I doing wrong?</p>