title: Swift DiffableDataSource Snapshot Not Updating
body: <p>I am working with DiffableDataSource inside of a collection view for the first time, but I am running into an error while trying to update a view.
  <br><br>
  So I am working with 2 custom cells. CustomCell1 is a cell that has a Label on the left and a UITextField on the right. CustomCell2 is a cell that has 2 column UIPickerView inside of it. CustomCell2 has a delegate that will let my main view controller know when it has been updated. This is all working fine.
  <br><br>
  So the problem is coming when I am trying to update the textfield in CustomCell1 with the value selected in the UIPickerView from CustomCell2. As a note, the textfield is being used for text entry in rows of the page. And the picker view is shown when a cell is clicked, and hidden when the cell is clicked again.
  <br><br>
  So in my delegate to update the cell, I have this code:</p>
  <pre><code>func updateSelectedCharacter(withCharacter character: String, indexPath: IndexPath) {
          print(character)
          DispatchQueue.main.async {
              guard let charItem = self.dataSource.itemIdentifier(for: IndexPath(row: indexPath.row - 1, section: indexPath.section)), let parentId = charItem.parentId else { return }
              self.updatePlayerData(forPlayerIndex: parentId, character: character)
              var snap = self.dataSource.snapshot()
              snap.reloadItems([charItem])
              self.dataSource.apply(snap)
          }
      }
  </code></pre>
  <p>And in my cellForRowAt, I have the following code to update the text field in the character cell (CustomCell1). The gameInfo object is a struct that has information, including the character name I am trying to display, that I will eventually store off into CoreData from the entries in the cells.</p>
  <pre><code>guard let parentId = info.parentId else { return UICollectionViewListCell() }
  let playerData = self.gameInfo.playerData[parentId]
  var obj = TextEntryCellInformation(title: rowTitle, rowType: info.rowType)
  obj.value = obj.value = playerData?.character
  obj.isSelectable = false
  return collectionView.dequeueConfiguredReusableCell(using: textEntryCell, for: indexPath, item: obj)
  </code></pre>
  <p>And here is the cell registration for that cell, where TextEntryCellInformation holds the row type, title for the label, and an optional value that can set textfield's text:</p>
  <pre><code>private func createTextEntryListCellRegistration() -&gt; UICollectionView.CellRegistration&lt;TextEntryCollectionViewCell, TextEntryCellInformation&gt; {
          return UICollectionView.CellRegistration&lt;TextEntryCollectionViewCell, TextEntryCellInformation&gt; { cell, indexPath, data in
              var config = TextEntryContentConfiguration()
              config.title = data.title
              config.tag = data.rowType.rawValue
              config.textChangedDelegate = self
              config.isSelectable = data.isSelectable
              config.customPlaceholder = &quot;required&quot;
              if let val = data.value {
                  config.textValue = val
              }
              cell.contentConfiguration = config
          }
      }
  </code></pre>
  <p>So now, I think I have explained most of the code. Whenever I select the value in the picker view, the first time it will show the value correctly in the character cell. But if I change the value, the text seems to disappear from the character cell. However, I am getting the correct value from the picker view, verified with the print call at the start of the delegate function. I am also verifying that after I apply in the update delegate function, I am running through the cell registration and the correct value is being assigned to the config.textValue. I am not sure why then, if the config is being data is being set as expected with the correct character name, why the UI is not updating to show that information.
  <br><br>
  I included what I think is the relevant code and information. However, if more is needed, I will definitely update.
  <br>
  Thanks in advance for any help given!</p>