title: UICollectionView datasource update order
body: <p>So I have an UICollectionView and the data source is just a simple array:</p>
  <pre><code>private(set) var selectedItems = [Item]() {
      didSet {
          updateTitle()
          adjustSelection()
      }
  }
  
  func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
      return selectedItems.count
  }
  </code></pre>
  <p>What is the correct order for removing an item, first from the collection view or from the data source?</p>
  <pre><code>func removeItemFromSelection(_ item: Item) {
      guard let index = selectedItems.firstIndex(of: item) else {
          return
      }
  
      collectionView?.deleteItems(at: [IndexPath(item: index, section: 0)])
      selectedItems.remove(at: index)
  }
  </code></pre>
  <p>So</p>
  <pre><code>collectionView?.deleteItems(at: [IndexPath(item: index, section: 0)])
  selectedItems.remove(at: index)
  </code></pre>
  <p>or</p>
  <pre><code>selectedItems.remove(at: index)
  collectionView?.deleteItems(at: [IndexPath(item: index, section: 0)])
    
  </code></pre>
  <p>Any documentation of this by any chance you know of?</p>
  <p>The first variation crashes on iOS 12.</p>