Load more favoritedBy-accounts (IOS-272)

This commit is contained in:
Nathan Mattes 2024-05-24 13:33:27 +02:00
parent b62e259335
commit 93b4b04ac2
1 changed files with 11 additions and 11 deletions

View File

@ -49,18 +49,8 @@ extension FavoritedByViewController {
tableView: tableView,
userTableViewCellDelegate: self
)
// setup batch fetch
viewModel.listBatchFetchViewModel.setup(scrollView: tableView)
viewModel.listBatchFetchViewModel.shouldFetch
.receive(on: DispatchQueue.main)
.sink { [weak self] _ in
guard let self = self else { return }
self.viewModel.stateMachine.enter(UserListViewModel.State.Loading.self)
}
.store(in: &disposeBag)
viewModel.listBatchFetchViewModel.shouldFetch.send()
viewModel.stateMachine.enter(UserListViewModel.State.Loading.self)
}
override func viewWillAppear(_ animated: Bool) {
@ -91,3 +81,13 @@ extension FavoritedByViewController: UITableViewDelegate, AutoGenerateTableViewD
// MARK: - UserTableViewCellDelegate
extension FavoritedByViewController: UserTableViewCellDelegate {}
//MARK: - UIScrollViewDelegate
extension FavoritedByViewController: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
ListBatchFetchViewModel.scrollViewdidScrollToEnd(scrollView) {
viewModel.stateMachine.enter(UserListViewModel.State.Loading.self)
}
}
}