quicker reloads when adding data

This commit is contained in:
Nihaal Sharma committed 2026-05-01 15:26:14 +01:00
1 parent 53d8c1ee5e
commit b0484fcaad
1 file changed
+7 -3
@@ -26,13 +26,17 @@ struct EmojiTableView: UIViewRepresentable {
let itemsBefore = context.coordinator.items
let itemsAfter = items
context.coordinator.items = items
context.coordinator.items = itemsAfter
if itemsAfter.count > itemsBefore.count {
var indexPaths: [IndexPath] = []
for i in (itemsBefore.count-1)...(itemsAfter.count-1) {
for i in (itemsBefore.count-1)..<(itemsAfter.count-1) {
indexPaths.append(IndexPath(row: i, section: 0))
}
uiView.insertRows(at: indexPaths, with: .fade)
// uiView.performBatchUpdates {
// context.coordinator.items = itemsAfter
uiView.insertRows(at: indexPaths, with: .fade)
// }
} else {
uiView.reloadData()
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.