diff --git a/AutoCat/Utils/RxRealmDataSource.swift b/AutoCat/Utils/RxRealmDataSource.swift index 5870100..f5e9808 100644 --- a/AutoCat/Utils/RxRealmDataSource.swift +++ b/AutoCat/Utils/RxRealmDataSource.swift @@ -17,6 +17,7 @@ class RealmSectionedDataSource: NSObject, UITableViewDataSource private var sections: [DateSection] = [] private var cellIdentifier: String private var filterPredicate: FilterPredicate? + private let groupQueue = DispatchQueue(label: "group") private let onSizeChanged: ((Int) -> Void)? @@ -94,13 +95,15 @@ class RealmSectionedDataSource: NSObject, UITableViewDataSource items = items.filter(predicate) } - DispatchQueue.global().async { + self.groupQueue.async { let newSections = items.groupedByDate() - let changeset = StagedChangeset(source: self.sections, target: newSections) +// let changeset = StagedChangeset(source: self.sections, target: newSections) DispatchQueue.main.async { - self.tv.reload(using: changeset, with: animated ? .fade : .none) { newSects in - self.sections = newSects - } + self.sections = newSections + self.tv.reloadData() +// self.tv.reload(using: changeset, with: animated ? .fade : .none) { newSects in +// self.sections = newSects +// } } } }