feat: add loader for initial snapshot and fix loader animation issue

This commit is contained in:
CMK 2021-06-22 17:49:07 +08:00
parent 80330c0809
commit 091856ddf0
2 changed files with 10 additions and 3 deletions

View File

@ -33,9 +33,13 @@ extension HomeTimelineViewModel {
threadReplyLoaderTableViewCellDelegate: nil
)
// var snapshot = NSDiffableDataSourceSnapshot<StatusSection, Item>()
// snapshot.appendSections([.main])
// diffableDataSource?.apply(snapshot)
var snapshot = NSDiffableDataSourceSnapshot<StatusSection, Item>()
snapshot.appendSections([.main])
diffableDataSource?.apply(snapshot)
// workaround to append loader wrong animation issue
snapshot.appendItems([.bottomLoader], toSection: .main)
diffableDataSource?.apply(snapshot)
}
}

View File

@ -32,6 +32,9 @@ extension UserTimelineViewModel {
// set empty section to make update animation top-to-bottom style
var snapshot = NSDiffableDataSourceSnapshot<StatusSection, Item>()
snapshot.appendSections([.main])
diffableDataSource?.apply(snapshot)
// workaround to append loader wrong animation issue
snapshot.appendItems([.bottomLoader], toSection: .main)
diffableDataSource?.apply(snapshot)
}