diffabledatasource

NSDiffableSnapshot causes collectionview's cell registration to be re-called even without any changes to the data

空扰寡人 提交于 2021-01-29 13:38:41
问题 I have a problem with NSDiffableDataSource . I have created this basic example containing a UICollectionView with a single item showing a random number: import UIKit class ViewController: UIViewController { enum Section { case main } enum Item { case myItem } var collectionView: UICollectionView! var dataSource: UICollectionViewDiffableDataSource<Section, Item>! lazy var myCellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, Void> { (cell, indexPath, _) in print(

DiffableDataSource: Snapshot Doesn't reload Headers & footers

喜夏-厌秋 提交于 2020-12-30 07:52:24
问题 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 Layout of UICollectionView 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. section 1 Header --> January 2020 - 5 Trips section 1 item 1 --> Trip 1

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

若如初见. 提交于 2020-07-09 03:54:32
问题 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 text is typed into the search field, I update the results list. Results move up and down in the list as their relevance changes. The trick is that I need to force every cell to re-render every time the search text changes, because a new search

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

╄→гoц情女王★ 提交于 2020-07-09 03:52:29
问题 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 text is typed into the search field, I update the results list. Results move up and down in the list as their relevance changes. The trick is that I need to force every cell to re-render every time the search text changes, because a new search