Questions tagged [nsdiffabledatasourcesnapshot]

44 questions
40
votes
4 answers

What is NSDiffableDataSourceSnapshot `reloadItems` for?

I'm having difficulty finding the use of NSDiffableDataSourceSnapshot reloadItems(_:): If the item I ask to reload is not equatable to an item that is already present in the data source, I crash with: Terminating app due to uncaught exception…
matt
  • 515,959
  • 87
  • 875
  • 1,141
15
votes
2 answers

How can I reload items without removing and inserting with UITableViewDiffableDataSource?

I'm implementing a search screen in my app using UITableViewDiffableDataSource. Each cell represents a search hit and highlights the search match in the cell title, kind of like Xcode's Open Quickly window highlights portions of its result items. As…
9
votes
5 answers

iOS13 DiffableDataSource Invalid parameter not satisfying: indexPath || ignoreInvalidItems

I'm converting my collection view to new iOS13 UICollectionViewDiffableDataSource... so I need to update cell information on demand. Here is my code: let snap = self.diffDataSouce.snapshot snap?.reloadItems(withIdentifiers: [itemToUpdate]) //reload…
Fabiosoft
  • 1,141
  • 14
  • 32
8
votes
0 answers

Diffable Data Source Scrolls to Top After Applying Snapshot with All New Data in Collection View

I have a collection view (using a compositional layout and a diffable data source) that has a segmented control in its header. When the control value changes, the cells update to a different UICollectionViewCell class with all new data. It mostly…
7
votes
2 answers

UICollectionViewCompositionalLayout optional sections

I have looked at this question, which is similar: How to deal with empty items section in UICollectionView CompositionalLayout, but the answer there seems to be either leave sections out in the snapshot (which I do, but that leaves another problem,…
6
votes
0 answers

iOS UICollectionViewDiffableDataSource reloads all data with no changes

I have a simple UICollectionView with 1 section and 1 item type powered by new iOS 13 UICollectionViewDiffableDataSource. Even with no changes to data source (identical hashValues), UICollectionViewDiffableDataSource updates whole collection view…
6
votes
0 answers

UICollectionViewCompositionalLayout's sticky header is jerky

I am trying to use the latest UICollectionViewCompositionalLayout to display paginated data using the UICollectionViewDiffableDataSource . I wanted to show a sticky header above the section that would stay on the top always even while loading the…
5
votes
2 answers

Diffable Snapshot reload section header

When reloading a table view data with NSDiffableDataSourceSnapshot, the table view will only reload sections that contain differences from the previous snapshot. I have a table view that contains entries with specific dates. The entries are ordered…
shbedev
  • 1,875
  • 17
  • 28
5
votes
1 answer

Applying NSDiffableDataSourceSnapshot to UICollectionViewDiffableDataSource causes 'NSInternalInconsistencyException'

I am trying to implement a UICollectionViewDiffableDataSource for my collectionView. My code compiles fine, however I keep running into this error the first time I apply a snapshot to it, with the following error: Terminating app due to uncaught…
4
votes
0 answers

Animation Glitch When Deleting UICollectionViewDiffableDataSource Item From Context Menu

I have adopted the new UICollectionViewDiffableDataSource. I am applying a datasource snapshot everytime I delete an item: var snapshot = NSDiffableDataSourceSnapshot
3
votes
1 answer

Modern UI CollectionViews with snapshots - How to update cell content without completely reloading the cell?

Duplication Allegations: This question has wrongfully been flagged as a duplicate of another question I asked. This question here is about communicating changes TO the cell without entirely reloading it (to dynamically change its content instead of…
SwiftedMind
  • 3,701
  • 3
  • 29
  • 63
3
votes
2 answers

UICollectionViewDiffableDataSource is replacing data instead of updating

I am trying to understand UICollectionViewDiffableDataSource and NSDiffableDataSourceSnapshot. I have created a very crude version below. Essentially on load it should fetch photos. On tap of a button in the navigation bar it fetches the next page.…
3
votes
1 answer

How to deal with inconsistent behavior when change snapshot animatedDifferences value?

I'll start with explanation how things suppose to work: I have collection view with compositional layout and diffable data source. Cells are representing tasks, which user can click on and set as done for today, cells have different appearance…
3
votes
2 answers

How to add Header Name in UITableViewDiffableDataSource

I try to add header title for each section in UITableView, but in this case it's UITableViewDiffableDataSource and I don't have any idea where I should do that. A part of my code: private func prepareTableView() { tableView.delegate = self …
2
votes
0 answers

performFetch creating diffable data source snapshots with too much data

After executing an NSBatchBatchInsertRequest and calling fetchedResultsController.performFetch(), the frc’s delegate method controller(_:didChangeContentWith:) is called with a NSDiffableDataSourceSnapshot that…
1
2 3