From 24f12926a12f7e80396861f29e5c4bdc53f297b4 Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Thu, 30 Apr 2026 13:35:33 +0100 Subject: [PATCH] deleting works from context menu, eg downloadedview --- .../CollectionView/EmojiCollectionView.swift | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/StickerSlack/UIKit/CollectionView/EmojiCollectionView.swift b/StickerSlack/UIKit/CollectionView/EmojiCollectionView.swift index 9e77fe4..f4fd9d7 100644 --- a/StickerSlack/UIKit/CollectionView/EmojiCollectionView.swift +++ b/StickerSlack/UIKit/CollectionView/EmojiCollectionView.swift @@ -45,17 +45,11 @@ struct EmojiCollectionView: UIViewRepresentable { } } -// if items != context.coordinator.items || context.coordinator.pack != pack { -// context.coordinator.items = items -// context.coordinator.pack = pack -// uiView.reloadData() -// } - -// let oldItems = context.coordinator.items -// let newItems = items -// newItems.difference(from: oldItems) -//// context.coordinator.items -// uiView.deleteItems(at: <#T##[IndexPath]#>) + if items != context.coordinator.items || context.coordinator.pack != pack { + context.coordinator.items = items + context.coordinator.pack = pack + uiView.reloadData() + } } func makeCoordinator() -> Coordinator { @@ -218,6 +212,10 @@ struct EmojiCollectionView: UIViewRepresentable { Task.detached { await self.hoarder.delete(emoji: self.hoarder.trie.dict[emojiName]) } + self.items.remove(at: indexPath.row) + collectionView.performBatchUpdates { + collectionView.deleteItems(at: [indexPath]) + } } delete.attributes.update(with: .destructive) return UIMenu(title: emojiName, children: [copyName, copyImage, share, delete])