trying to redo sizeforitemat, figuring out better tableview reloads

This commit is contained in:
Nihaal Sharma committed 2026-05-01 15:05:27 +01:00
1 parent 646725dc11
commit 53d8c1ee5e
4 files changed
+21 -2

No files matched your search

@@ -23,8 +23,19 @@ struct EmojiTableView: UIViewRepresentable {
func updateUIView(_ uiView: UITableView, context: Context) {
context.coordinator.hoarder = hoarder
let itemsBefore = context.coordinator.items
let itemsAfter = items
context.coordinator.items = items
uiView.reloadData()
if itemsAfter.count > itemsBefore.count {
var indexPaths: [IndexPath] = []
for i in (itemsBefore.count-1)...(itemsAfter.count-1) {
indexPaths.append(IndexPath(row: i, section: 0))
}
uiView.insertRows(at: indexPaths, with: .fade)
} else {
uiView.reloadData()
}
}
func makeCoordinator() -> Coordinator {
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.