Questions tagged [diffabledatasource]

92 questions
28
votes
3 answers

Unable to swipe to delete with tableview using diffable data source in iOS 13

I'm updating a UITableViewController to use the new UITableViewDiffableDataSource, I have everything working except Swipe to delete. This is an example of how I use swipe to delete func tableView(_ tableView: UITableView,…
DogCoffee
  • 19,820
  • 10
  • 87
  • 120
19
votes
0 answers

UITableViewDiffableDataSource set different cell animations

I'm using UITableViewDiffableDataSource to render cells, and I wonder how to animate rows granularily. There's a property self.dataSource?.defaultRowAnimation = .fade which apply for all rows of the tableView, but I would like some animation for…
Martin
  • 11,881
  • 6
  • 64
  • 110
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…
13
votes
3 answers

UITableViewDiffableDataSource with different objects

I am currently facing troubles using UITableViewDiffableDataSource. I would like to give a shot to this new feature, so I went on many tutorials on the net, but none of them seems to answer my issue. In my current viewController I have a…
Alexandre Odet
  • 372
  • 2
  • 13
13
votes
3 answers

DiffableDataSource with multiple cell types

I'm looking at DiffableDataSource available in iOS13 (or backported here: https://github.com/ra1028/DiffableDataSources) and cannot figure out how one would support multiple cell types in your collection or tableview. Apple's sample code1 has: var…
Jason Moore
  • 7,169
  • 1
  • 44
  • 45
12
votes
2 answers

DiffableDataSource: Snapshot Doesn't reload Headers & footers

I am using UICollectionViewDiffableDataSource for UICollectionView to display content in multiple sections. I am using Collection View Compositional Layout and Diffable Datasources link which was introduced at WWDC'19 to render the Multiple Section…
11
votes
3 answers

Can UITableViewDiffableDataSource detect an item changed?

(The question was rewritten after discussing with @AndreasOetjen below. Thanks for his comments.) I ran into an issue with using UITableView with diffable data source. In my app when user modifies an item, it may change another item which is shown…
rayx
  • 1,329
  • 10
  • 23
10
votes
3 answers

Swift DiffableDataSource make insert&delete instead of reload

I have a hard time to understand how DiffableDataSource works. I have ViewModel like this struct ViewModel: Hashable { var id: Int var value: String func hash(into hasher: inout Hasher) { hasher.combine(id) } } I have tableView…
Angelus
  • 177
  • 1
  • 11
9
votes
1 answer

Why do Diffable Datasources treat class and struct types differently?

Diffable datasources require specifying a SectionIdentifierType and an ItemIdentifierType and these types have to conform to Hashable Supposedly they must conform to Hashable so that the datasource can do its diffing. So why does it behave…
Bryan Bryce
  • 1,310
  • 1
  • 16
  • 29
9
votes
1 answer

CollectionView Compositional Layout with Multiple Data Types

I was playing around with Compositional Layouts with Diffable DataSource and so far loving it. But all of my endeavors have included a single type of Data Item. What I'm trying to achieve is have two different types of List, say Car and Airplane So…
n1schal
  • 91
  • 3
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
7
votes
4 answers

Stop Diffable Data Source scrolling to top after refresh

How can I stop a diffable data source scrolling the view to the top after applying the snapshot. I currently have this... fileprivate func configureDataSource() { self.datasource = UICollectionViewDiffableDataSource
mickeysox
  • 159
  • 2
  • 14
7
votes
3 answers

UICollectionView List With Custom Configuration - how to pass changes in cell to view controller?

I've implemented a UICollectionView list with custom a custom UICollectionViewCell and UIContentConfiguration using the new iOS 14 API. I've been following this tutorial: https://swiftsenpai.com/development/uicollectionview-list-custom-cell/…
SwiftedMind
  • 3,701
  • 3
  • 29
  • 63
7
votes
0 answers

Diffable Data Source performance issue

I have used diffable data source with UITableView for a while and I like it. But today I realized one issue inherent in its design. To use diffable data source, one needs to generate and apply snapshot when data changes. If the data volume is large,…
rayx
  • 1,329
  • 10
  • 23
7
votes
1 answer

Diffable Data source with more than one section using core data

WWDC 2019 was really packed with new stuff for iOS and the new data sources for TableViews and CollectionView which is UITableViewDiffableDataSource . I have successfully integrate the above new data source with Core data , delete and insert new…
ghadeer aqraa
  • 159
  • 2
  • 11
1
2 3 4 5 6 7