feat: add loader for initial snapshot in notification scene

This commit is contained in:
CMK 2021-06-22 17:58:11 +08:00
parent d9490533ee
commit 6400729367
2 changed files with 9 additions and 0 deletions

View File

@ -29,6 +29,14 @@ extension NotificationViewModel {
delegate: delegate, delegate: delegate,
dependency: dependency dependency: dependency
) )
var snapshot = NSDiffableDataSourceSnapshot<NotificationSection, NotificationItem>()
snapshot.appendSections([.main])
diffableDataSource.apply(snapshot)
// workaround to append loader wrong animation issue
snapshot.appendItems([.bottomLoader], toSection: .main)
diffableDataSource.apply(snapshot)
} }
} }

View File

@ -35,6 +35,7 @@ final class NotificationViewModel: NSObject {
// output // output
var diffableDataSource: UITableViewDiffableDataSource<NotificationSection, NotificationItem>! var diffableDataSource: UITableViewDiffableDataSource<NotificationSection, NotificationItem>!
// top loader // top loader
private(set) lazy var loadLatestStateMachine: GKStateMachine = { private(set) lazy var loadLatestStateMachine: GKStateMachine = {
// exclude timeline middle fetcher state // exclude timeline middle fetcher state