1
0
mirror of https://github.com/metabolist/metatext synced 2024-12-27 02:02:38 +01:00

Ensure proper cell layout

This commit is contained in:
Justin Mazzocchi 2021-03-12 11:09:40 -08:00
parent 9389e1c3b8
commit ac2d1fb805
No known key found for this signature in database
GPG Key ID: E223E6937AAFB01C

View File

@ -803,7 +803,7 @@ private extension TableViewController {
self.newItemsViewVisibleConstraint?.isActive = true
self.view.layoutIfNeeded()
} completion: { _ in
self.view.layoutIfNeeded()
self.reloadVisibleItems()
}
}
@ -814,8 +814,18 @@ private extension TableViewController {
self.newItemsViewVisibleConstraint?.isActive = false
self.view.layoutIfNeeded()
} 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