title: Updating UICollectionView after deleting a Realm object
body: <p>When I try to delete an item from a Realm database I am unable to update a UICollection View appropriately.</p>
  
  <p>Lets assume a Realm container <code>children</code> of type <code>List&lt;Child&gt;</code>: </p>
  
  <pre><code>var children = realm.objects(Parent).first!.children 
  </code></pre>
  
  <p>When I want to remove this child from the database by:</p>
  
  <pre><code>try! realm.write {
      realm.delete(children[indexPath.row])
  }
  </code></pre>
  
  <p>updating the collectionView by <code>collectionView.deleteItemsAtIndexPaths([indexPath])</code> gives the following error:</p>
  
  <pre><code>Got error: *** Terminating app due to uncaught exception 'RLMException', reason: 'Object has been deleted or invalidated.'
  </code></pre>
  
  <p>The only way I get the collectionView updated is by using <code>collectionView.reloadData()</code>, but that is not what I want since the animation of a cell deletion is missing.</p>
  
  <p>However, when I only remove a child from this container at <code>indexPath.row</code> (without removing it from the database) by:</p>
  
  <pre><code>try! realm.write {
      children.removeAtIndex(indexPath.row)
  }
  </code></pre>
  
  <p>updating the collectionView with <code>collectionView.deleteItemsAtIndexPaths([indexPath])</code> works without problems. </p>
  
  <p>What would be the best way to update a UICollectionView after removing an item from the database?</p>