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
|
// MARK: Functions
|
||||||
func fetch() {
|
func fetch() async {
|
||||||
Task {
|
|
||||||
isFilterEnabled = false
|
isFilterEnabled = false
|
||||||
isLoading = items.isEmpty
|
isLoading = items.isEmpty
|
||||||
|
|
||||||
@ -104,7 +103,6 @@ extension FeedListViewController {
|
|||||||
|
|
||||||
isLoading = false
|
isLoading = false
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func filter(by option: FilterOption) {
|
func filter(by option: FilterOption) {
|
||||||
guard option != filter else { return }
|
guard option != filter else { return }
|
||||||
|
@ -118,7 +118,7 @@ final class FeedListViewController: UIViewController {
|
|||||||
registerTableCells()
|
registerTableCells()
|
||||||
bindViewModel()
|
bindViewModel()
|
||||||
|
|
||||||
viewModel.fetch()
|
Task { await viewModel.fetch() }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ private extension FeedListViewController {
|
|||||||
|
|
||||||
// MARK: Actions
|
// MARK: Actions
|
||||||
@objc func refresh(_ sender: AnyObject) {
|
@objc func refresh(_ sender: AnyObject) {
|
||||||
self.viewModel.fetch()
|
Task { await self.viewModel.fetch() }
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Functions
|
// MARK: Functions
|
||||||
@ -264,7 +264,7 @@ private extension FeedListViewController {
|
|||||||
)
|
)
|
||||||
: nil,
|
: nil,
|
||||||
action: isErrorState
|
action: isErrorState
|
||||||
? { self.viewModel.fetch() }
|
? { Task { await self.viewModel.fetch() } }
|
||||||
: nil
|
: nil
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user