Set row height when table is empty and set to automatic when articles are present. Issue #1919

This commit is contained in:
Maurice Parker 2020-03-18 16:06:05 -05:00
parent d3033a12e2
commit 8a75defee9
1 changed files with 7 additions and 1 deletions

View File

@ -630,10 +630,16 @@ private extension MasterTimelineViewController {
}
func applyChanges(animated: Bool, completion: (() -> Void)? = nil) {
if coordinator.articles.count == 0 {
tableView.rowHeight = tableView.estimatedRowHeight
} else {
tableView.rowHeight = UITableView.automaticDimension
}
var snapshot = NSDiffableDataSourceSnapshot<Int, Article>()
snapshot.appendSections([0])
snapshot.appendItems(coordinator.articles, toSection: 0)
dataSource.apply(snapshot, animatingDifferences: animated) { [weak self] in
self?.restoreSelectionIfNecessary(adjustScroll: false)
completion?()