Questions tagged [nsdiffabledatasourcesnapshot]

44 questions
2
votes
0 answers

Apply NSDiffableDataSourceSnapshot with same data results in a animation

I have a UITableView with a UITableViewDiffableDataSource in which I support a pull to refresh and a pagination. When I'm creating a new snapshot with the same data and apply that snapshot, it results in a weird animation where the first few…
2
votes
1 answer

Crash number of items in section 0 when there are only 0 sections in the collection view

I want to learn using UICollectionViewDiffableDataSource using Pinterest Layout, but when I try to running my simulator. it crash and give me a message request for number of items in section 0 when there are only 0 sections in the collection…
2
votes
2 answers

NFetchedResultsController delegate method didChangeContentWith is not called when deleted an item using UIDIffableDataSource tableview

I am trying to implement my existing coredata project using the UITableViewDiffableDataSource. My tableview is coupled using the NSFetchedResultsController and the corresponding delegate methods. I am able to list the data in the tableview using…
2
votes
1 answer

iOS 13 NSDiffableDataSourceSnapshot in UITableView/UICollectionView delegates

I have been playing around with the new iOS 13 diffable data sources and find them very easy and straight forward to use. However I am unsure about 1 thing. Is it recommended to use the snapshot property of the diffable data sources for example in…
crashoverride777
  • 10,581
  • 2
  • 32
  • 56
1
vote
0 answers

How to apply multiple NSDiffableDataSourceSectionSnapshot at once?

I'm building UICollectionView with new diffable NSDiffableDataSourceSnapshot and NSDiffableDataSourceSectionSnapshot. I need to use NS…SectionSnapshot to populate my UICollectionView with outline items. First, I create NS…Snapshot, set all section…
1
vote
1 answer

Compositional UICollectionView with NSDiffableDataSource jumps when reloading

I have a compositional layout for my UICollectionView. This is the code for creating the layout. func createLayout() -> UICollectionViewLayout { let layout = UICollectionViewCompositionalLayout { [weak self] section, _ ->…
1
vote
1 answer

How to Use NSTableViewDiffableDataSource to Load Data with NSTableView

I'm trying to learn how to use NSTableViewDiffableDataSource to load data with NSTableView. I am able to use UITableViewDiffableDataSource and UICollectionViewDiffableDataSource to load data in iOS because I have found some examples online. But I…
1
vote
1 answer

Using a UITableViewDropCoordinator to animate drops via the dropDelegate with a diffable data source

In iOS 11 Apple introduced native drag and drop to TableViews which provided specifc animations for common drag and drop interactions. Assuming you had returned the correct UIDropProposal it would easily animate a reordering drop in a table…
1
vote
0 answers

Using Custom CollectionView layout with NSDiffableDataSource

I'm trying to use NSDiffableDataSource with my custom CollectionView layout. The position and size of each cell depends on the number of elements in the collection. It also uses UIDynamicAnimator to produces springy behaviour. The problem is when a…
1
vote
1 answer

Data not display in collectionView DiffableDataSource MVVM RxSwift

I'm learning MVVM and RxSwift, and I want to display data from GitHub api and populate into collectionViewDiffableDataSource. But it's not displaying my data, even with my snapshot is already setup to accept my data. This is my code class…
1
vote
2 answers

UICollectionView - Section Snapshots - "Failed to find index of item" when removing sections or items

I want to create a collectionView with dynamic sections that also can be collapsed. This seems to be quite easy with the new section snapshots in iOS 14. This is what I have (fully working example). import UIKit enum Section: Hashable { case…
SwiftedMind
  • 3,701
  • 3
  • 29
  • 63
1
vote
2 answers

Getting an 'NSInternalInconsistencyException', reason: 'Invalid section 0.' when doing a search on multiple sections

I am getting an exception when doing a search on multiple section. It occurs when applying a snapshot on the datasource. Background: I have (pre-defined) sections, and each section has a collection of items. Sections won't appear in the…
1
vote
1 answer

CollectionView using NSDiffableDataSource with UICollectionViewFlowLayout

When I use UICollectionView with UICollectionViewFlowLayout set. And then try to apply snapshots of datasource via // load initial data reloadDataSource() DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(3)) { …
1
vote
1 answer

SwiftUI CollectionView wrapper cannot apply snapshot from updateUIViewController

I have implemented such UICollectionView wrapper struct CollectionView: UIViewControllerRepresentable { // MARK: - Properties let layout: UICollectionViewLayout let sections: [Section] let items: [Section: [Item]] // MARK: -…
Michał Ziobro
  • 10,759
  • 11
  • 88
  • 143
1
vote
1 answer

Adding, changing and deleting with a diffeable datasource

Ok, I've got a preliminary working version of a collectionview with a diffable datasource. All is working and I just implemented adding and changing items, and deleting items still to be done. There is little information out there as of current on…