Load more discovery news right away (IOS-272)
This commit is contained in:
parent
6b99c9def3
commit
a86fc70828
|
@ -57,17 +57,6 @@ extension DiscoveryNewsViewController {
|
|||
self.refreshControl.endRefreshing()
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
||||
// 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 }
|
||||
guard self.view.window != nil else { return }
|
||||
self.viewModel.stateMachine.enter(DiscoveryNewsViewModel.State.Loading.self)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
|
@ -205,3 +194,13 @@ extension DiscoveryNewsViewController: TableViewControllerNavigateable {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
//MARK: - UIScrollViewDelegate
|
||||
|
||||
extension DiscoveryNewsViewController: UIScrollViewDelegate {
|
||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
ListBatchFetchViewModel.scrollViewdidScrollToEnd(scrollView) {
|
||||
viewModel.stateMachine.enter(DiscoveryNewsViewModel.State.Loading.self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue