fixed bug in refreshcontroller
Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
4f0d099f60
commit
b9bd3ae310
@ -112,7 +112,6 @@ class EmployeesViewController: UIViewController {
|
|||||||
.sink { [weak self] _ in
|
.sink { [weak self] _ in
|
||||||
self?.updateFooter()
|
self?.updateFooter()
|
||||||
self?.tableView.reloadData()
|
self?.tableView.reloadData()
|
||||||
self?.tableView.refreshControl?.endRefreshing()
|
|
||||||
}
|
}
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
||||||
@ -123,6 +122,7 @@ class EmployeesViewController: UIViewController {
|
|||||||
self?.activityIndicator.startAnimating()
|
self?.activityIndicator.startAnimating()
|
||||||
} else {
|
} else {
|
||||||
self?.activityIndicator.stopAnimating()
|
self?.activityIndicator.stopAnimating()
|
||||||
|
self?.tableView.refreshControl?.endRefreshing() // End refresh control
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|||||||
@ -65,13 +65,12 @@ public class EmployeesViewModel: ObservableObject {
|
|||||||
totalEmployees = wrapper.total
|
totalEmployees = wrapper.total
|
||||||
currentPage = page
|
currentPage = page
|
||||||
hasMorePages = employees.count < totalEmployees
|
hasMorePages = employees.count < totalEmployees
|
||||||
isLoading = false
|
|
||||||
|
|
||||||
} catch {
|
} catch {
|
||||||
// Handle errors
|
// Handle errors
|
||||||
isLoading = false
|
|
||||||
errorMessage = "An unexpected error occurred, please try to refresh."
|
errorMessage = "An unexpected error occurred, please try to refresh."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isLoading = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user