Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

Support for Diffable datasource #452

Open
rizwan95 opened this issue Jan 8, 2020 · 5 comments
Open

Support for Diffable datasource #452

rizwan95 opened this issue Jan 8, 2020 · 5 comments

Comments

@rizwan95
Copy link

rizwan95 commented Jan 8, 2020

It would be great if the support for diffable datasource is given! @dzenbot

@dzenbot
Copy link
Owner

dzenbot commented Jan 9, 2020

Please, explain. That request is very vague.

@rizwan95
Copy link
Author

rizwan95 commented Jan 9, 2020

Apple introduced Diffable datasources for TableViews and collectionviews from iOS 13 onwards. Instead of UITableViewDataSource, DiffableDatasource can be used. Which means that we should not explicitly call reloadData or performBatch updates. The diffable datasource will take care of things.

So we need support for the developers who use diffable datasourece.

WWDC link : https://developer.apple.com/videos/play/wwdc2019/220

@dzenbot

@whoyawn
Copy link

whoyawn commented May 19, 2020

@rizwan95 UITableViewDiffableDataSource conforms to UITableViewDataSource. It's still possible to use. Just call tableView.reloadEmptyDataSet() after calling apply(snapshot:animatingDifferences:) and implement emptyDataSetShouldDisplay(_: UIScrollView!) to check your data models.

@rizwan95
Copy link
Author

rizwan95 commented May 19, 2020

@whoyawn : Yes, tableView.reloadEmptyDataSet() works, but when a diffable data source is used, we are not supposed to call tableView.reloadData() according to Apple. So, does this affect ```
reloadEmptyDataSet()

@whoyawn
Copy link

whoyawn commented May 19, 2020

The comment above reloadEmptyDataSet() says

/**
Reloads the empty dataset content receiver.
@discussion Call this method to force all the data to refresh. Calling -reloadData is similar, but this forces only the empty dataset to reload, not the entire table view or collection view.
*/

So it shouldn't call the reloadData() nor do any heavy table view related operations at all. @dzenbot Correct me if I'm wrong.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants