Made the "fetch()" function for the FeedListViewController view controller in the Feed framework to use Swift concurrency.
This commit is contained in:
parent
a1abe1f4ae
commit
8eec6f5666
@ -61,8 +61,7 @@ extension FeedListViewController {
|
||||
}
|
||||
|
||||
// MARK: Functions
|
||||
func fetch() {
|
||||
Task {
|
||||
func fetch() async {
|
||||
isFilterEnabled = false
|
||||
isLoading = items.isEmpty
|
||||
|
||||
@ -104,7 +103,6 @@ extension FeedListViewController {
|
||||
|
||||
isLoading = false
|
||||
}
|
||||
}
|
||||
|
||||
func filter(by option: FilterOption) {
|
||||
guard option != filter else { return }
|
||||
|
@ -118,7 +118,7 @@ final class FeedListViewController: UIViewController {
|
||||
registerTableCells()
|
||||
bindViewModel()
|
||||
|
||||
viewModel.fetch()
|
||||
Task { await viewModel.fetch() }
|
||||
}
|
||||
|
||||
}
|
||||
@ -170,7 +170,7 @@ private extension FeedListViewController {
|
||||
|
||||
// MARK: Actions
|
||||
@objc func refresh(_ sender: AnyObject) {
|
||||
self.viewModel.fetch()
|
||||
Task { await self.viewModel.fetch() }
|
||||
}
|
||||
|
||||
// MARK: Functions
|
||||
@ -264,7 +264,7 @@ private extension FeedListViewController {
|
||||
)
|
||||
: nil,
|
||||
action: isErrorState
|
||||
? { self.viewModel.fetch() }
|
||||
? { Task { await self.viewModel.fetch() } }
|
||||
: nil
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user