added emojipackdetailview uikit

bcak to observableobject
ios 15 minimum
context menu to fix multi delete
added duplicate button to the pack menu
consolidated edit mode setting on collecitoview
notifications
emojipack notifications take id instead of pack
This commit is contained in:
Nihaal Sharma committed 2026-07-03 13:47:16 +01:00
1 parent 26c9205187
commit a1d231054e
14 files changed
+200 -65

No files matched your search

+17 -5
View File
@@ -158,6 +158,10 @@
A9E8C79E2FF726DA009A38B5 /* EmojiHoarder.LetterStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E8C79D2FF726D4009A38B5 /* EmojiHoarder.LetterStats.swift */; };
A9E8C79F2FF726DA009A38B5 /* EmojiHoarder.LetterStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E8C79D2FF726D4009A38B5 /* EmojiHoarder.LetterStats.swift */; };
A9E8C7A02FF726DA009A38B5 /* EmojiHoarder.LetterStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E8C79D2FF726D4009A38B5 /* EmojiHoarder.LetterStats.swift */; };
A9E8C7A22FF7B815009A38B5 /* EmojiPackDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E8C7A12FF7B815009A38B5 /* EmojiPackDetailViewController.swift */; };
A9E8C7A32FF7B815009A38B5 /* EmojiPackDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E8C7A12FF7B815009A38B5 /* EmojiPackDetailViewController.swift */; };
A9E8C7A52FF7C34A009A38B5 /* EmojiPackDetailViewRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E8C7A42FF7C34A009A38B5 /* EmojiPackDetailViewRepresentable.swift */; };
A9E8C7A62FF7C34A009A38B5 /* EmojiPackDetailViewRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E8C7A42FF7C34A009A38B5 /* EmojiPackDetailViewRepresentable.swift */; };
A9EB72392EB93FDB00658CEB /* EmojiTableViewRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72382EB93FDB00658CEB /* EmojiTableViewRepresentable.swift */; };
A9EB72472EB948C400658CEB /* StickerRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72462EB948C400658CEB /* StickerRow.swift */; };
A9EB72492EB948C400658CEB /* StickerRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72462EB948C400658CEB /* StickerRow.swift */; };
@@ -280,6 +284,8 @@
A9E8C78E2FF71D8C009A38B5 /* DownloadedViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadedViewController.swift; sourceTree = "<group>"; };
A9E8C7992FF7256B009A38B5 /* EmojiHoarder.Packs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiHoarder.Packs.swift; sourceTree = "<group>"; };
A9E8C79D2FF726D4009A38B5 /* EmojiHoarder.LetterStats.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiHoarder.LetterStats.swift; sourceTree = "<group>"; };
A9E8C7A12FF7B815009A38B5 /* EmojiPackDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackDetailViewController.swift; sourceTree = "<group>"; };
A9E8C7A42FF7C34A009A38B5 /* EmojiPackDetailViewRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackDetailViewRepresentable.swift; sourceTree = "<group>"; };
A9EB72382EB93FDB00658CEB /* EmojiTableViewRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiTableViewRepresentable.swift; sourceTree = "<group>"; };
A9EB72462EB948C400658CEB /* StickerRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerRow.swift; sourceTree = "<group>"; };
A9EB724C2EB94A6B00658CEB /* TrieTestingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrieTestingView.swift; sourceTree = "<group>"; };
@@ -335,6 +341,7 @@
A9A7A4672F6AA17C00BB84C6 /* Int.swift */,
A995D95A2F6EBBDD0043E5F5 /* TestStructures.swift */,
A9C52F742F89A93D00078588 /* URL.swift */,
A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */,
);
path = Extensions;
sourceTree = "<group>";
@@ -397,6 +404,8 @@
A9C52F712F89A85F00078588 /* ShareSheet.swift */,
A9FB3EE22FA7AB3A00030E2A /* UIKitGifView.swift */,
A9E8C78E2FF71D8C009A38B5 /* DownloadedViewController.swift */,
A9E8C7A12FF7B815009A38B5 /* EmojiPackDetailViewController.swift */,
A9E8C7A42FF7C34A009A38B5 /* EmojiPackDetailViewRepresentable.swift */,
);
path = UIKit;
sourceTree = "<group>";
@@ -578,7 +587,6 @@
A9F423C42F8722AA00C0BE3B /* Misc */ = {
isa = PBXGroup;
children = (
A9BBC5172EB8FA4500FFE82F /* ViewModifiers.swift */,
A9BDEADD2F82BC93002798DF /* NoStickersView.swift */,
A9C52F6A2F8988CD00078588 /* EmptyCollectionView.swift */,
);
@@ -748,12 +756,14 @@
A9A7A43F2F6835F800BB84C6 /* Trending.swift in Sources */,
A9A7A4422F68360200BB84C6 /* GifObject.swift in Sources */,
A9E8C79A2FF7256B009A38B5 /* EmojiHoarder.Packs.swift in Sources */,
A9E8C7A32FF7B815009A38B5 /* EmojiPackDetailViewController.swift in Sources */,
A97322A62FA8CA2B004B657D /* JumboMojiTestView.swift in Sources */,
A975F9192FA38C8D00A5C62E /* EmojiPackGridView.swift in Sources */,
A957C1772ECD008E00EA3EE9 /* Bundle.swift in Sources */,
A957C17F2ECFAA1100EA3EE9 /* GifView.swift in Sources */,
A957C1742ECCE2CE00EA3EE9 /* SettingsView.swift in Sources */,
A9A7A44B2F6837A800BB84C6 /* GiphyUser.swift in Sources */,
A9E8C7A62FF7C34A009A38B5 /* EmojiPackDetailViewRepresentable.swift in Sources */,
A9EB72392EB93FDB00658CEB /* EmojiTableViewRepresentable.swift in Sources */,
A98BD15D2FF5242700ADC264 /* EmojiPackPreview.swift in Sources */,
A955B3EE2EC22C4A00E1732D /* DownloadedView.swift in Sources */,
@@ -864,6 +874,7 @@
A9A7A4492F68361200BB84C6 /* Meta.swift in Sources */,
A9EB724A2EB948E000658CEB /* EmojiTableViewRepresentable.swift in Sources */,
A9EB724D2EB94A6B00658CEB /* TrieTestingView.swift in Sources */,
A9E8C7A22FF7B815009A38B5 /* EmojiPackDetailViewController.swift in Sources */,
A98BD15C2FF5242700ADC264 /* EmojiPackPreview.swift in Sources */,
A9BBC51A2EB8FA4500FFE82F /* ViewModifiers.swift in Sources */,
A995D95B2F6EBBDD0043E5F5 /* TestStructures.swift in Sources */,
@@ -882,6 +893,7 @@
A9CD6C392EDDE37500B7F421 /* EmojiPackManager.swift in Sources */,
A9E8C7902FF71D8C009A38B5 /* DownloadedViewController.swift in Sources */,
A955B3F62EC22EE900E1732D /* SearchView.swift in Sources */,
A9E8C7A52FF7C34A009A38B5 /* EmojiPackDetailViewRepresentable.swift in Sources */,
A97322A52FA8CA2B004B657D /* JumboMojiTestView.swift in Sources */,
A98FA6622FF3BD5400D50212 /* EmojiCollectionView.swift in Sources */,
A9BDEADF2F82BC93002798DF /* NoStickersView.swift in Sources */,
@@ -1075,7 +1087,7 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 17;
IPHONEOS_DEPLOYMENT_TARGET = 15;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13;
@@ -1127,7 +1139,7 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 17;
IPHONEOS_DEPLOYMENT_TARGET = 15;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13;
@@ -1164,7 +1176,7 @@
INFOPLIST_FILE = StickerSlackiMessageApp/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = StickerSlack;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 17;
IPHONEOS_DEPLOYMENT_TARGET = 15;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -1196,7 +1208,7 @@
INFOPLIST_FILE = StickerSlackiMessageApp/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = StickerSlack;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 17;
IPHONEOS_DEPLOYMENT_TARGET = 15;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -77,6 +77,7 @@ struct EmojiPack: Identifiable, Codable, Equatable, Hashable {
mutating func add(_ newItem: String) {
guard !items.contains(newItem) else { return }
self.items.append(newItem)
NotificationCenter.default.post(name: EmojiHoarder.NotifCategory.emojiPack(id).name, object: nil)
}
mutating func remove(_ itemToRemove: String) {
@@ -84,6 +85,7 @@ struct EmojiPack: Identifiable, Codable, Equatable, Hashable {
return
}
self.items.remove(at: index)
NotificationCenter.default.post(name: EmojiHoarder.NotifCategory.emojiPack(id).name, object: nil)
}
mutating func addRemove(_ item: String) {
@@ -48,7 +48,7 @@ extension EmojiHoarder {
withAnimation {
emojiPacks.removeAll { $0.id == packToRemove.id }
}
sendChangeNotif(for: .emojiPack(packToRemove))
sendChangeNotif(for: .emojiPack(packToRemove.id))
sendChangeNotif(for: .emojiPacks)
saveEmojiPacks()
}
+10 -10
View File
@@ -11,24 +11,24 @@ import Combine
import UniformTypeIdentifiers
import Haptics
@Observable class EmojiHoarder: BaseHoarder {
class EmojiHoarder: BaseHoarder {
static let container: URL = library.appendingPathComponent("Emojis", conformingTo: .directory)
nonisolated static let localEmojiDB: URL = EmojiHoarder.library.appendingPathComponent("localEmojiDB.json", conformingTo: .fileURL)
nonisolated static let localTrieDict: URL = EmojiHoarder.library.appendingPathComponent("localTrieDict.json", conformingTo: .fileURL)
nonisolated static let packStore: URL = EmojiHoarder.library.appendingPathComponent("packStore.json", conformingTo: .fileURL)
let endpoint: URL = URL(string: "https://cachet.dunkirk.sh/emojis")!
var emojis: [Emoji] = []
var emojiPacks: [EmojiPack] = []
@Published var emojis: [Emoji] = []
@Published var emojiPacks: [EmojiPack] = []
var trie: Trie = Trie()
// @Published var downloadedStickers: Set<String> = []
var downloadedStickersArr: [String] = []
@Published var downloadedStickersArr: [String] = []
var letterStats: [EmojiHoarder.LetterStat] = []
var letterStatsSorting: EmojiHoarder.LetterStatSorting = .init(by: .letter, ascending: true)
@Published var letterStats: [EmojiHoarder.LetterStat] = []
@Published var letterStatsSorting: EmojiHoarder.LetterStatSorting = .init(by: .letter, ascending: true)
var showWelcome: Bool = false
@Published var showWelcome: Bool = false
init(localOnly: Bool = false, skipIndex: Bool = false) {
super.init()
@@ -277,7 +277,7 @@ import Haptics
case emojis
case downloadedEmojis
case emojiPacks
case emojiPack(EmojiPack)
case emojiPack(UUID)
var name: Notification.Name {
switch self {
@@ -287,8 +287,8 @@ import Haptics
Notification.Name("EmojiHoarder.notif.downloadedEmojis")
case .emojiPacks:
Notification.Name("EmojiHoarder.notif.emojiPacks")
case .emojiPack(let emojiPack):
Notification.Name("EmojiHoarder.notif.emojiPack.\(emojiPack.id)")
case .emojiPack(let emojiPackID):
Notification.Name("EmojiHoarder.notif.emojiPack.\(emojiPackID)")
}
}
}
@@ -169,3 +169,22 @@ struct fadeIn: ViewModifier {
}
}
}
//nonisolated func contextMenu<I, M>(forSelectionType itemType: I.Type = I.self, @ViewBuilder menu: @escaping (Set<I>) -> M, primaryAction: ((Set<I>) -> Void)? = nil) -> some View where I : Hashable, M : View
struct ContextMenuSafe<I, M>: ViewModifier where I : Hashable, M : View {
var itemType: I.Type = I.self
@ViewBuilder var menu: (Set<I>) -> M
var primaryAction: ((Set<I>) -> Void)? = nil
func body(content: Content) -> some View {
if #available(iOS 16, *) {
content
.contextMenu(forSelectionType: itemType) { items in
menu(items)
}
} else {
content
}
}
}
+2 -3
View File
@@ -10,15 +10,14 @@ import SwiftUI
import UniformTypeIdentifiers
import Combine
@Observable class GifHoarder: BaseHoarder {
class GifHoarder: BaseHoarder {
static let container: URL = library.appendingPathComponent("Gifs", conformingTo: .directory)
static var apiKey: String = "a2mFsDTpX5blodY8ltkG6Q1xy5NgFSbc"
var endpoint: URL = URL(string: "https://api.giphy.com/v1/gifs/trending")!
var endpointSearch: URL = URL(string: "https://api.giphy.com/v1/gifs/search")!
var searchTerm: String = ""
var trendingGifs: [Gif] = []
@Published var trendingGifs: [Gif] = []
// @Published override var downloadedStickers: Set<String> = []
init(localOnly: Bool = false) {
+2 -2
View File
@@ -21,10 +21,10 @@ protocol Hoarder: ObservableObject {
nonisolated func delete(emoji: any StickerProtocol, skipStoreIndex: Bool) async
}
@Observable class BaseHoarder: Hoarder {
class BaseHoarder: Hoarder {
static let library: URL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.neon443.StickerSlack")!.appendingPathComponent("Library", conformingTo: .directory)
var downloadedStickers: Set<String> = []
@Published var downloadedStickers: Set<String> = []
var encoder: JSONEncoder = JSONEncoder()
var decoder: JSONDecoder = JSONDecoder()
@@ -168,10 +168,12 @@ struct EmojiPackDetailView: View {
ShareLink(item: pack.shareLink()) {
Image(systemName: "square.and.arrow.up")
}
.disabled(pack.items.isEmpty)
} else {
Button("", systemImage: "square.and.arrow.up") {
showShare.toggle()
}
.disabled(pack.items.isEmpty)
.sheet(isPresented: $showShare) {
ShareSheet(activityItems: [pack.shareLink()])
}
@@ -31,14 +31,10 @@ struct EmojiPackManager: View {
ForEach($hoarder.emojiPacks, id: \.self) { $pack in
NavigationLink {
EmojiPackDetailView(hoarder: hoarder, pack: $pack, useSwiftUIGrid: useSwiftUIGrid)
EmojiPackDetailViewRepresentable(hoarder: hoarder, pack: pack)
} label: {
Text(pack.name)
}
.contextMenu {
EmojiPackActionButtons(hoarder: hoarder, pack: pack, showLabelText: true)
} preview: {
EmojiPackPreview(hoarder: hoarder, pack: pack)
}
.swipeActions(edge: .trailing) {
EmojiPackActionButtons(hoarder: hoarder, pack: pack, showLabelText: false)
}
@@ -50,6 +46,17 @@ struct EmojiPackManager: View {
hoarder.removeEmojiPack(atOffsets: indexSet)
}
}
.modifier(ContextMenuSafe(itemType: EmojiPack.self, menu: { items in
if items.count == 1 {
EmojiPackActionButtons(hoarder: hoarder, pack: items.first ?? .test, showLabelText: true)
} else {
Button("Delete \(items.count) pack\(items.count.plural)", systemImage: "trash", role: .destructive) {
for item in items {
hoarder.removeEmojiPack(item)
}
}
}
}))
}
}
.navigationTitle("Emoji Packs")
@@ -66,22 +73,6 @@ struct EmojiPackManager: View {
ToolbarItem(placement: .topBarLeading) {
EditButton()
}
#if compiler(>=6.2)
if #available(iOS 19, *) {
ToolbarSpacer()
}
#endif
ToolbarItem(placement: .topBarLeading) {
Button("", systemImage: "trash") {
for pack in selection {
hoarder.removeEmojiPack(pack)
}
selection = []
}
.disabled(selection.isEmpty)
}
}
}
}
@@ -94,13 +85,13 @@ struct EmojiPackManager: View {
@State private var showShareSheet: Bool = false
var body: some View {
Button {
Button(showLabelText ? "Delete" : "", systemImage: "trash", role: .destructive) {
hoarder.removeEmojiPack(pack)
} label: {
Label(showLabelText ? "Delete" : "", systemImage: "trash")
.foregroundStyle(.red)
}
.tint(.red)
Button(showLabelText ? "Duplicate" : "", systemImage: "plus.square.fill.on.square.fill") {
hoarder.addEmojiPack(pack)
}
if #available(iOS 16, *) {
if showLabelText {
ShareLink(item: pack.shareLink())
@@ -14,7 +14,6 @@ final class EmojiCollectionView: UICollectionViewController, UICollectionViewDel
var items: [String]
var width: CGFloat
var style: EmojiCollectionView.Style
var edit: Bool? = false
var onRemove: ((String) -> Void)?
var onTap: ((String) -> Void)?
@@ -59,7 +58,7 @@ final class EmojiCollectionView: UICollectionViewController, UICollectionViewDel
}
layout.estimatedItemSize = UICollectionViewFlowLayout.automaticSize
refreshUI(edit: false, with: items)
refreshUI(with: items)
}
required init?(coder: NSCoder) {
@@ -75,23 +74,17 @@ final class EmojiCollectionView: UICollectionViewController, UICollectionViewDel
}
override func viewWillLayoutSubviews() {
self.refreshUI(edit: edit, with: items)
self.refreshUI(with: items)
}
func refreshUI(edit: Bool? = false, with items: [String]) {
self.edit = edit
if edit ?? false {
self.startAnimating()
} else {
self.stopAnimating()
func refreshUI(with items: [String]) {
guard !items.isEmpty else {
self.items = []
Task.detached {
await self.instantApplySnapshot()
}
for cell in collectionView.visibleCells {
if let cell = cell as? EmojiCollectionViewCell {
cell.setEdit(to: edit)
return
}
}
let itemsBefore = self.items
let itemsAfter = items
self.items = items
@@ -137,7 +130,7 @@ final class EmojiCollectionView: UICollectionViewController, UICollectionViewDel
cell = collectionView.dequeueReusableCell(withReuseIdentifier: "plain", for: indexPath) as! PlainEmojiCollectionViewCell
case .full, .plainWithLabel:
cell = collectionView.dequeueReusableCell(withReuseIdentifier: "full", for: indexPath) as! EmojiCollectionViewCell
(cell as! EmojiCollectionViewCell).setEdit(to: edit)
(cell as! EmojiCollectionViewCell).setEdit(to: isEditing)
(cell as! EmojiCollectionViewCell).onRemove = {
guard let index = self.items.firstIndex(of: $0) else { return }
self.items.remove(at: index)
@@ -178,6 +171,20 @@ final class EmojiCollectionView: UICollectionViewController, UICollectionViewDel
}
}
override func setEditing(_ editing: Bool, animated: Bool) {
super.setEditing(editing, animated: animated)
for cell in collectionView.visibleCells {
if let cell = cell as? EmojiCollectionViewCell {
cell.setEdit(to: isEditing)
}
}
if editing {
self.startAnimating()
} else {
self.stopAnimating()
}
}
override func collectionView(
_ collectionView: UICollectionView,
contextMenuConfigurationForItemAt indexPath: IndexPath,
@@ -27,11 +27,11 @@ struct EmojiCollectionViewRepresentable: UIViewRepresentable {
func updateUIView(_ uiView: UICollectionView, context: Context) {
context.coordinator.hoarder = hoarder
context.coordinator.items = items
context.coordinator.edit = edit
context.coordinator.onRemove = onRemoveSUI
context.coordinator.onTap = onTapCallback
context.coordinator.setEditing(edit ?? false, animated: true)
uiView.setNeedsLayout()
context.coordinator.refreshUI(edit: edit, with: items)
context.coordinator.refreshUI(with: items)
}
func makeCoordinator() -> EmojiCollectionView {
@@ -23,7 +23,12 @@ class DownloadedViewController: UINavigationController, UINavigationControllerDe
downloadedView.navigationItem.title = "Saved"
super.init(rootViewController: downloadedView)
NotificationCenter.default.addObserver(self, selector: #selector(downloadedEmojisChanged), name: EmojiHoarder.NotifCategory.downloadedEmojis.name, object: nil)
NotificationCenter.default.addObserver(
self,
selector: #selector(downloadedEmojisChanged),
name: EmojiHoarder.NotifCategory.downloadedEmojis.name,
object: nil
)
}
required init?(coder aDecoder: NSCoder) {
@@ -0,0 +1,71 @@
//
// EmojiPackDetailViewController.swift
// StickerSlack
//
// Created by neon443 on 03/07/2026.
//
import Foundation
import UIKit
class EmojiPackDetailViewController: UINavigationController {
var hoarder: EmojiHoarder
var pack: EmojiPack
let collectionView: EmojiCollectionView
init(with hoarder: EmojiHoarder, andPack pack: EmojiPack) {
self.hoarder = hoarder
self.pack = pack
self.collectionView = EmojiCollectionView(
hoarder: hoarder,
items: pack.items,
width: 75,
style: .full
)
super.init(rootViewController: collectionView)
let editButton = UIBarButtonItem(systemItem: .edit)
let downloadButton = UIBarButtonItem(
image: UIImage(systemName: "arrow.down"),
style: .plain,
target: nil,
action: nil
)
let shareButton = UIBarButtonItem(
image: UIImage(systemName: "square.and.arrow.up"),
style: .plain,
target: nil,
action: nil
)
collectionView.navigationItem.title = "HI"
collectionView.toolbarItems = [editButton, downloadButton, shareButton]
NotificationCenter.default.addObserver(
self,
selector: #selector(packChanged),
name: EmojiHoarder.NotifCategory.emojiPack(pack.id).name,
object: nil
)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc func packChanged(_ notification: Notification) {
if notification.name == EmojiHoarder.NotifCategory.emojiPack(pack.id).name {
print("ooh its this pack")
guard let updatedPack = hoarder.emojiPacks.first(where: { $0.id == pack.id }) else { return }
self.pack = updatedPack
collectionView.refreshUI(with: pack.items)
} else {
print("diff one")
}
}
override func setEditing(_ editing: Bool, animated: Bool) {
super.setEditing(editing, animated: animated)
collectionView.setEditing(editing, animated: animated)
}
}
@@ -0,0 +1,27 @@
//
// EmojiPackDetailViewRepresentable.swift
// StickerSlack
//
// Created by neon443 on 03/07/2026.
//
import Foundation
import UIKit
import SwiftUI
struct EmojiPackDetailViewRepresentable: UIViewControllerRepresentable {
typealias UIViewControllerType = UINavigationController
var hoarder: EmojiHoarder
var pack: EmojiPack
func makeUIViewController(context: Context) -> UINavigationController {
let view = EmojiPackDetailViewController(with: hoarder, andPack: pack)
view.isToolbarHidden = false
return view
}
func updateUIViewController(_ uiViewController: UINavigationController, context: Context) {
}
}
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.