mirror of
https://github.com/metabolist/metatext.git
synced 2024-12-18 11:46:27 +00:00
Fix jumping when restoring scroll position
This commit is contained in:
parent
6518f8a19d
commit
b7644cdd62
2 changed files with 9 additions and 1 deletions
|
@ -59,6 +59,14 @@ final class TableViewDataSource: UITableViewDiffableDataSource<CollectionSection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func applySnapshotUsingReloadData(
|
||||||
|
_ snapshot: NSDiffableDataSourceSnapshot<CollectionSection.Identifier, CollectionItem>,
|
||||||
|
completion: (() -> Void)? = nil) {
|
||||||
|
updateQueue.async {
|
||||||
|
super.applySnapshotUsingReloadData(snapshot, completion: completion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
||||||
let currentSnapshot = snapshot()
|
let currentSnapshot = snapshot()
|
||||||
let section = currentSnapshot.sectionIdentifiers[section]
|
let section = currentSnapshot.sectionIdentifiers[section]
|
||||||
|
|
|
@ -497,7 +497,7 @@ private extension TableViewController {
|
||||||
setPreviousOffset = true
|
setPreviousOffset = true
|
||||||
}
|
}
|
||||||
|
|
||||||
self.dataSource.apply(update.sections.snapshot(), animatingDifferences: false) { [weak self] in
|
self.dataSource.applySnapshotUsingReloadData(update.sections.snapshot()) { [weak self] in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
|
|
||||||
if let itemId = update.maintainScrollPositionItemId,
|
if let itemId = update.maintainScrollPositionItemId,
|
||||||
|
|
Loading…
Reference in a new issue