mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
deleting works from context menu, eg downloadedview
This commit is contained in:
1 file changed
+9
-11
@@ -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])
|
||||
|
||||