Enable prefetching on iOS 15 to improve Timeline scrolling speed
This commit is contained in:
parent
0d4f4054ce
commit
079e764f13
|
@ -83,10 +83,6 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
||||||
iconSize = AppDefaults.shared.timelineIconSize
|
iconSize = AppDefaults.shared.timelineIconSize
|
||||||
resetEstimatedRowHeight()
|
resetEstimatedRowHeight()
|
||||||
|
|
||||||
if #available(iOS 15, *) {
|
|
||||||
tableView.isPrefetchingEnabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
if let titleView = Bundle.main.loadNibNamed("MasterTimelineTitleView", owner: self, options: nil)?[0] as? MasterTimelineTitleView {
|
if let titleView = Bundle.main.loadNibNamed("MasterTimelineTitleView", owner: self, options: nil)?[0] as? MasterTimelineTitleView {
|
||||||
navigationItem.titleView = titleView
|
navigationItem.titleView = titleView
|
||||||
}
|
}
|
||||||
|
@ -579,9 +575,13 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func reloadAllVisibleCells() {
|
@objc private func reloadAllVisibleCells() {
|
||||||
|
if #available(iOS 15, *) {
|
||||||
|
reconfigureCells(coordinator.articles)
|
||||||
|
} else {
|
||||||
let visibleArticles = tableView.indexPathsForVisibleRows!.compactMap { return dataSource.itemIdentifier(for: $0) }
|
let visibleArticles = tableView.indexPathsForVisibleRows!.compactMap { return dataSource.itemIdentifier(for: $0) }
|
||||||
reloadCells(visibleArticles)
|
reloadCells(visibleArticles)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func reloadCells(_ articles: [Article]) {
|
private func reloadCells(_ articles: [Article]) {
|
||||||
var snapshot = dataSource.snapshot()
|
var snapshot = dataSource.snapshot()
|
||||||
|
@ -591,6 +591,15 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func reconfigureCells(_ articles: [Article]) {
|
||||||
|
guard #available(iOS 15, *) else { return }
|
||||||
|
var snapshot = dataSource.snapshot()
|
||||||
|
snapshot.reconfigureItems(articles)
|
||||||
|
dataSource.apply(snapshot, animatingDifferences: false) { [weak self] in
|
||||||
|
self?.restoreSelectionIfNecessary(adjustScroll: false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: Cell Configuring
|
// MARK: Cell Configuring
|
||||||
|
|
||||||
private func resetEstimatedRowHeight() {
|
private func resetEstimatedRowHeight() {
|
||||||
|
|
Loading…
Reference in New Issue