fixed toolbar edit button in packdetailview

This commit is contained in:
Nihaal Sharma committed 2026-07-03 22:21:31 +01:00
1 parent 698c711ab7
commit b939071674
1 file changed
+11 -12
@@ -25,8 +25,8 @@ class EmojiPackDetailViewController: UINavigationController {
) )
super.init(rootViewController: collectionView) super.init(rootViewController: collectionView)
let editButton = UIBarButtonItem(systemItem: .edit) let editButton = collectionView.editButtonItem
editButton.target = self editButton.target = collectionView
let downloadButton = UIBarButtonItem( let downloadButton = UIBarButtonItem(
image: UIImage(systemName: "arrow.down"), image: UIImage(systemName: "arrow.down"),
style: .plain, style: .plain,
@@ -39,8 +39,10 @@ class EmojiPackDetailViewController: UINavigationController {
target: nil, target: nil,
action: nil action: nil
) )
collectionView.navigationItem.title = "HI" collectionView.navigationItem.title = pack.name
collectionView.toolbarItems = [editButton, downloadButton, shareButton] // collectionView.toolbarItems = [editButton, downloadButton, shareButton]
collectionView.navigationItem.leftBarButtonItem = editButton
collectionView.navigationItem.rightBarButtonItems = [shareButton, downloadButton]
NotificationCenter.default.addObserver( NotificationCenter.default.addObserver(
self, self,
@@ -55,14 +57,11 @@ class EmojiPackDetailViewController: UINavigationController {
} }
@objc func packChanged(_ notification: Notification) { @objc func packChanged(_ notification: Notification) {
if notification.name == EmojiHoarder.NotifCategory.emojiPack(pack.id).name { guard notification.name == EmojiHoarder.NotifCategory.emojiPack(pack.id).name else { return }
print("ooh its this pack") guard let updatedPack = hoarder.emojiPacks.first(where: { $0.id == pack.id }) else { return }
guard let updatedPack = hoarder.emojiPacks.first(where: { $0.id == pack.id }) else { return } self.pack = updatedPack
self.pack = updatedPack collectionView.navigationItem.title = pack.name
collectionView.refreshUI(with: pack.items) collectionView.refreshUI(with: pack.items)
} else {
print("diff one")
}
} }
override func setEditing(_ editing: Bool, animated: Bool) { override func setEditing(_ editing: Bool, animated: Bool) {
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.