fix: the data source update queue , change activityIndicatorView color

This commit is contained in:
sunxiaojian 2021-04-23 19:15:52 +08:00
parent 61a26fbe66
commit d6d91180cb
2 changed files with 7 additions and 8 deletions

View File

@ -162,7 +162,6 @@ final class SearchViewModel: NSObject {
.store(in: &disposeBag)
requestRecommendAccountsV2()
.receive(on: DispatchQueue.main)
.sink { [weak self] _ in
guard let self = self else { return }
if !self.recommendAccounts.isEmpty {
@ -176,7 +175,6 @@ final class SearchViewModel: NSObject {
.sink { [weak self] _ in
guard let self = self else { return }
self.requestRecommendAccounts()
.receive(on: DispatchQueue.main)
.sink { [weak self] _ in
guard let self = self else { return }
if !self.recommendAccounts.isEmpty {
@ -295,11 +293,13 @@ final class SearchViewModel: NSObject {
}
func applyDataSource() {
guard let dataSource = accountDiffableDataSource else { return }
var snapshot = NSDiffableDataSourceSnapshot<RecommendAccountSection, NSManagedObjectID>()
snapshot.appendSections([.main])
snapshot.appendItems(recommendAccounts, toSection: .main)
dataSource.apply(snapshot, animatingDifferences: false, completion: nil)
DispatchQueue.main.async {
guard let dataSource = self.accountDiffableDataSource else { return }
var snapshot = NSDiffableDataSourceSnapshot<RecommendAccountSection, NSManagedObjectID>()
snapshot.appendSections([.main])
snapshot.appendItems(self.recommendAccounts, toSection: .main)
dataSource.apply(snapshot, animatingDifferences: false, completion: nil)
}
}
func receiveAccounts(ids: [String]) {

View File

@ -62,7 +62,6 @@ final class SuggestionAccountTableViewCell: UITableViewCell {
let activityIndicatorView: UIActivityIndicatorView = {
let activityIndicatorView = UIActivityIndicatorView(style: .medium)
activityIndicatorView.color = .white
activityIndicatorView.hidesWhenStopped = true
return activityIndicatorView
}()