mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-25 09:41:00 +00:00
Ensure proper cell layout
This commit is contained in:
parent
9389e1c3b8
commit
ac2d1fb805
1 changed files with 12 additions and 2 deletions
|
@ -803,7 +803,7 @@ private extension TableViewController {
|
||||||
self.newItemsViewVisibleConstraint?.isActive = true
|
self.newItemsViewVisibleConstraint?.isActive = true
|
||||||
self.view.layoutIfNeeded()
|
self.view.layoutIfNeeded()
|
||||||
} completion: { _ in
|
} completion: { _ in
|
||||||
self.view.layoutIfNeeded()
|
self.reloadVisibleItems()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,8 +814,18 @@ private extension TableViewController {
|
||||||
self.newItemsViewVisibleConstraint?.isActive = false
|
self.newItemsViewVisibleConstraint?.isActive = false
|
||||||
self.view.layoutIfNeeded()
|
self.view.layoutIfNeeded()
|
||||||
} completion: { _ in
|
} completion: { _ in
|
||||||
self.view.layoutIfNeeded()
|
self.reloadVisibleItems()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func reloadVisibleItems() {
|
||||||
|
guard let visibleItems = tableView.indexPathsForVisibleRows?.compactMap(dataSource.itemIdentifier(for:))
|
||||||
|
else { return }
|
||||||
|
|
||||||
|
var snapshot = dataSource.snapshot()
|
||||||
|
|
||||||
|
snapshot.reloadItems(visibleItems)
|
||||||
|
dataSource.apply(snapshot, animatingDifferences: false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// swiftlint:enable file_length
|
// swiftlint:enable file_length
|
||||||
|
|
Loading…
Reference in a new issue