title: DiffableDataSource: Snapshot Doesn't reload Headers & footers
body: <p>I am using <code>UICollectionViewDiffableDataSource</code> for <code>UICollectionView</code> to display content in multiple sections.</p>
  
  <p>I am using Collection View Compositional Layout and Diffable Datasources <a href="https://developer.apple.com/videos/play/wwdc2019/215/" rel="noreferrer">link</a> which was introduced at WWDC'19 to render the Multiple Section Layout of <code>UICollectionView</code></p>
  
  <p>I have a simple setup, The Header for each section shows number of items in that section, and Footer shows the summary of all items of the section.</p>
  
  <blockquote>
    <p>section 1 Header --> January 2020  -  5 Trips<br>
    section 1 item 1 --> Trip 1<br>
    section 1 item 2 --> Trip 2<br>
    section 1 item 3 --> Trip 3<br>
    section 1 item 4 --> Trip 4<br>
    section 1 item 5 --> Trip 5</p>
  </blockquote>
  
  <p>now If a trip is deleted, the DiffableDataSource updates the change by animation but it doesn't reload the Headers of the sections. Which looks inconsistent. E.g. If the Trip 4 was deleted then Header still shows that there are 5 trips in the section. How can I have headers also reload with the DiffableDataSource?</p>
  
  <p>for a temporary fix, I just call
  <code>collectionView.reloadData()</code> after a delay which shows the Diffing animation and then I hard reload the data which forces the header to be reloaded as well.</p>
  
  <pre class="lang-swift prettyprint-override"><code>private func configureTripDataSource(){
      tripDataSource = UICollectionViewDiffableDataSource&lt;MonthSection, Trip&gt;(collectionView: tripsCollectionView, cellProvider: { (collectionView, indexPath, trip) -&gt; UICollectionViewCell? in
  
          // Get a cell of the desired kind.
          guard let cell = collectionView.dequeueReusableCell(
              withReuseIdentifier: TripInfoCell.reuseIdentifier,
              for: indexPath) as? TripInfoCell else { fatalError("Cannot create new TripInfoCell") }
  
          // Populate the cell with our item description.
          cell.trip = trip
  
          // Return the cell.
          return cell
  
      })
  
      tripDataSource.supplementaryViewProvider = {
         [weak self] (collectionView: UICollectionView, kind: String, indexPath: IndexPath) -&gt; UICollectionReusableView? in
  
          guard let self = self else {return nil}
  
          if kind == TripsController.tripsMonthSectionHeaderElementKind{
  
              // Get a supplementary view of the desired kind.
              guard let header = collectionView.dequeueReusableSupplementaryView(
                  ofKind: kind,
                  withReuseIdentifier: TripSectionHeaderCell.reuseIdentifier,
                  for: indexPath) as? TripSectionHeaderCell else { fatalError("Cannot create new header") }
  
              // setup header
  
              let currentSnapShot = self.tripDataSource.snapshot()
              let tripMonthSection = currentSnapShot.sectionIdentifiers[indexPath.section]
  
              header.titleLabel.text = tripMonthSection.title
              header.subtitleLabel.text = "\(tripMonthSection.trips.count) Trips"
  
              return header
  
          } else {
              return UICollectionReusableView()
          }
  
      }
  
      var snapshot = NSDiffableDataSourceSnapshot&lt;MonthSection, Trip&gt;()
  
      let allSections = self.tripsStore.monthSections
      snapshot.appendSections(allSections)
      for section in allSections{
          snapshot.appendItems(section.trips, toSection: section)
      }
  
      self.tripDataSource.apply(snapshot, animatingDifferences: true)
  }
  </code></pre>