uikit app lifecycle

uikit contentview
searchview doesnt need a binding to a search term anymore
fix delete and share swipe actions being the wrong way round
fixed content not extending below the tab bar in browse view
This commit is contained in:
Nihaal Sharma committed 2026-06-30 09:55:13 +01:00
1 parent a823208d8b
commit d17bbd2e91
12 files changed
+127 -99

No files matched your search

+12 -6
View File
@@ -70,6 +70,8 @@
A986A6CE2EB659E000B6E0FA /* StickerBrowserDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = A986A6CB2EB659E000B6E0FA /* StickerBrowserDataSource.swift */; }; A986A6CE2EB659E000B6E0FA /* StickerBrowserDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = A986A6CB2EB659E000B6E0FA /* StickerBrowserDataSource.swift */; };
A986A6CF2EB659E000B6E0FA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A986A6C62EB659E000B6E0FA /* Assets.xcassets */; }; A986A6CF2EB659E000B6E0FA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A986A6C62EB659E000B6E0FA /* Assets.xcassets */; };
A986A6D12EB659E000B6E0FA /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A986A6C92EB659E000B6E0FA /* MainInterface.storyboard */; }; A986A6D12EB659E000B6E0FA /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A986A6C92EB659E000B6E0FA /* MainInterface.storyboard */; };
A98FA65B2FF3B29700D50212 /* EmojiTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98FA65A2FF3B29700D50212 /* EmojiTableView.swift */; };
A98FA65C2FF3B29700D50212 /* EmojiTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98FA65A2FF3B29700D50212 /* EmojiTableView.swift */; };
A99589AF2F5E0D83003A4A8C /* image.png in Resources */ = {isa = PBXBuildFile; fileRef = A99589AE2F5E0D83003A4A8C /* image.png */; }; A99589AF2F5E0D83003A4A8C /* image.png in Resources */ = {isa = PBXBuildFile; fileRef = A99589AE2F5E0D83003A4A8C /* image.png */; };
A99589B02F5E0D83003A4A8C /* image.png in Resources */ = {isa = PBXBuildFile; fileRef = A99589AE2F5E0D83003A4A8C /* image.png */; }; A99589B02F5E0D83003A4A8C /* image.png in Resources */ = {isa = PBXBuildFile; fileRef = A99589AE2F5E0D83003A4A8C /* image.png */; };
A99589B12F5E0D83003A4A8C /* image.png in Resources */ = {isa = PBXBuildFile; fileRef = A99589AE2F5E0D83003A4A8C /* image.png */; }; A99589B12F5E0D83003A4A8C /* image.png in Resources */ = {isa = PBXBuildFile; fileRef = A99589AE2F5E0D83003A4A8C /* image.png */; };
@@ -146,10 +148,10 @@
A9CD6C3B2EDDE6B500B7F421 /* EmojiPack.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9D15B892EB1142C00404792 /* EmojiPack.swift */; }; A9CD6C3B2EDDE6B500B7F421 /* EmojiPack.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9D15B892EB1142C00404792 /* EmojiPack.swift */; };
A9D15B8B2EB1142C00404792 /* EmojiPack.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9D15B892EB1142C00404792 /* EmojiPack.swift */; }; A9D15B8B2EB1142C00404792 /* EmojiPack.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9D15B892EB1142C00404792 /* EmojiPack.swift */; };
A9D6A8212F7014AE00F198FB /* TestStructures.swift in Sources */ = {isa = PBXBuildFile; fileRef = A995D95A2F6EBBDD0043E5F5 /* TestStructures.swift */; }; A9D6A8212F7014AE00F198FB /* TestStructures.swift in Sources */ = {isa = PBXBuildFile; fileRef = A995D95A2F6EBBDD0043E5F5 /* TestStructures.swift */; };
A9EB72392EB93FDB00658CEB /* EmojiTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72382EB93FDB00658CEB /* EmojiTableView.swift */; }; A9EB72392EB93FDB00658CEB /* EmojiTableViewRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72382EB93FDB00658CEB /* EmojiTableViewRepresentable.swift */; };
A9EB72472EB948C400658CEB /* StickerRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72462EB948C400658CEB /* StickerRow.swift */; }; A9EB72472EB948C400658CEB /* StickerRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72462EB948C400658CEB /* StickerRow.swift */; };
A9EB72492EB948C400658CEB /* StickerRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72462EB948C400658CEB /* StickerRow.swift */; }; A9EB72492EB948C400658CEB /* StickerRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72462EB948C400658CEB /* StickerRow.swift */; };
A9EB724A2EB948E000658CEB /* EmojiTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72382EB93FDB00658CEB /* EmojiTableView.swift */; }; A9EB724A2EB948E000658CEB /* EmojiTableViewRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB72382EB93FDB00658CEB /* EmojiTableViewRepresentable.swift */; };
A9EB724B2EB94A5700658CEB /* Trie.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C172DB2EB8C9AC008A7885 /* Trie.swift */; }; A9EB724B2EB94A5700658CEB /* Trie.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C172DB2EB8C9AC008A7885 /* Trie.swift */; };
A9EB724D2EB94A6B00658CEB /* TrieTestingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB724C2EB94A6B00658CEB /* TrieTestingView.swift */; }; A9EB724D2EB94A6B00658CEB /* TrieTestingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB724C2EB94A6B00658CEB /* TrieTestingView.swift */; };
A9EB724F2EB94A6B00658CEB /* TrieTestingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB724C2EB94A6B00658CEB /* TrieTestingView.swift */; }; A9EB724F2EB94A6B00658CEB /* TrieTestingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EB724C2EB94A6B00658CEB /* TrieTestingView.swift */; };
@@ -233,6 +235,7 @@
A986A6C82EB659E000B6E0FA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; }; A986A6C82EB659E000B6E0FA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
A986A6CA2EB659E000B6E0FA /* MessagesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagesViewController.swift; sourceTree = "<group>"; }; A986A6CA2EB659E000B6E0FA /* MessagesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagesViewController.swift; sourceTree = "<group>"; };
A986A6CB2EB659E000B6E0FA /* StickerBrowserDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerBrowserDataSource.swift; sourceTree = "<group>"; }; A986A6CB2EB659E000B6E0FA /* StickerBrowserDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerBrowserDataSource.swift; sourceTree = "<group>"; };
A98FA65A2FF3B29700D50212 /* EmojiTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiTableView.swift; sourceTree = "<group>"; };
A99589AE2F5E0D83003A4A8C /* image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = image.png; sourceTree = "<group>"; }; A99589AE2F5E0D83003A4A8C /* image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = image.png; sourceTree = "<group>"; };
A995D95A2F6EBBDD0043E5F5 /* TestStructures.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestStructures.swift; sourceTree = "<group>"; }; A995D95A2F6EBBDD0043E5F5 /* TestStructures.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestStructures.swift; sourceTree = "<group>"; };
A9A7A43E2F6835F800BB84C6 /* Trending.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Trending.swift; sourceTree = "<group>"; }; A9A7A43E2F6835F800BB84C6 /* Trending.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Trending.swift; sourceTree = "<group>"; };
@@ -263,7 +266,7 @@
A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackManager.swift; sourceTree = "<group>"; }; A9CD6C372EDDE37500B7F421 /* EmojiPackManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackManager.swift; sourceTree = "<group>"; };
A9D15B892EB1142C00404792 /* EmojiPack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPack.swift; sourceTree = "<group>"; }; A9D15B892EB1142C00404792 /* EmojiPack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPack.swift; sourceTree = "<group>"; };
A9E2ECD72EB74CE00038B2D6 /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; }; A9E2ECD72EB74CE00038B2D6 /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
A9EB72382EB93FDB00658CEB /* EmojiTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiTableView.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>"; }; 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>"; }; A9EB724C2EB94A6B00658CEB /* TrieTestingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrieTestingView.swift; sourceTree = "<group>"; };
A9F7B37F2F8951210071F198 /* EmojiPackImporterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackImporterView.swift; sourceTree = "<group>"; }; A9F7B37F2F8951210071F198 /* EmojiPackImporterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPackImporterView.swift; sourceTree = "<group>"; };
@@ -442,8 +445,9 @@
A94F3E632F9E384D00FA6995 /* TableView */ = { A94F3E632F9E384D00FA6995 /* TableView */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A9EB72382EB93FDB00658CEB /* EmojiTableView.swift */, A98FA65A2FF3B29700D50212 /* EmojiTableView.swift */,
A9C52F782F89BB0800078588 /* EmojiTableViewCell.swift */, A9C52F782F89BB0800078588 /* EmojiTableViewCell.swift */,
A9EB72382EB93FDB00658CEB /* EmojiTableViewRepresentable.swift */,
); );
path = TableView; path = TableView;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -713,6 +717,7 @@
A949B1F52EA04E8200215164 /* StickerSlackApp.swift in Sources */, A949B1F52EA04E8200215164 /* StickerSlackApp.swift in Sources */,
A9A7A4452F68360900BB84C6 /* Pagination.swift in Sources */, A9A7A4452F68360900BB84C6 /* Pagination.swift in Sources */,
A9104C802EB4022500D160EA /* MSSticker.swift in Sources */, A9104C802EB4022500D160EA /* MSSticker.swift in Sources */,
A98FA65C2FF3B29700D50212 /* EmojiTableView.swift in Sources */,
A9A7A43F2F6835F800BB84C6 /* Trending.swift in Sources */, A9A7A43F2F6835F800BB84C6 /* Trending.swift in Sources */,
A9A7A4422F68360200BB84C6 /* GifObject.swift in Sources */, A9A7A4422F68360200BB84C6 /* GifObject.swift in Sources */,
A97322A62FA8CA2B004B657D /* JumboMojiTestView.swift in Sources */, A97322A62FA8CA2B004B657D /* JumboMojiTestView.swift in Sources */,
@@ -722,7 +727,7 @@
A957C17F2ECFAA1100EA3EE9 /* GifView.swift in Sources */, A957C17F2ECFAA1100EA3EE9 /* GifView.swift in Sources */,
A957C1742ECCE2CE00EA3EE9 /* SettingsView.swift in Sources */, A957C1742ECCE2CE00EA3EE9 /* SettingsView.swift in Sources */,
A9A7A44B2F6837A800BB84C6 /* GiphyUser.swift in Sources */, A9A7A44B2F6837A800BB84C6 /* GiphyUser.swift in Sources */,
A9EB72392EB93FDB00658CEB /* EmojiTableView.swift in Sources */, A9EB72392EB93FDB00658CEB /* EmojiTableViewRepresentable.swift in Sources */,
A955B3EE2EC22C4A00E1732D /* DownloadedView.swift in Sources */, A955B3EE2EC22C4A00E1732D /* DownloadedView.swift in Sources */,
A949B1FB2EA0518800215164 /* SlackResponse.swift in Sources */, A949B1FB2EA0518800215164 /* SlackResponse.swift in Sources */,
A957C17A2ECE542D00EA3EE9 /* GifManager.swift in Sources */, A957C17A2ECE542D00EA3EE9 /* GifManager.swift in Sources */,
@@ -824,7 +829,7 @@
A9CD6C3B2EDDE6B500B7F421 /* EmojiPack.swift in Sources */, A9CD6C3B2EDDE6B500B7F421 /* EmojiPack.swift in Sources */,
A9BE30EF2F5B004800A57668 /* GifHoarder.swift in Sources */, A9BE30EF2F5B004800A57668 /* GifHoarder.swift in Sources */,
A9A7A4492F68361200BB84C6 /* Meta.swift in Sources */, A9A7A4492F68361200BB84C6 /* Meta.swift in Sources */,
A9EB724A2EB948E000658CEB /* EmojiTableView.swift in Sources */, A9EB724A2EB948E000658CEB /* EmojiTableViewRepresentable.swift in Sources */,
A9EB724D2EB94A6B00658CEB /* TrieTestingView.swift in Sources */, A9EB724D2EB94A6B00658CEB /* TrieTestingView.swift in Sources */,
A9BBC51A2EB8FA4500FFE82F /* ViewModifiers.swift in Sources */, A9BBC51A2EB8FA4500FFE82F /* ViewModifiers.swift in Sources */,
A995D95B2F6EBBDD0043E5F5 /* TestStructures.swift in Sources */, A995D95B2F6EBBDD0043E5F5 /* TestStructures.swift in Sources */,
@@ -833,6 +838,7 @@
A9A7A4682F6AA17C00BB84C6 /* Int.swift in Sources */, A9A7A4682F6AA17C00BB84C6 /* Int.swift in Sources */,
A97322A22FA7B9C8004B657D /* JumboMoji.swift in Sources */, A97322A22FA7B9C8004B657D /* JumboMoji.swift in Sources */,
A9C172DC2EB8C9AC008A7885 /* Trie.swift in Sources */, A9C172DC2EB8C9AC008A7885 /* Trie.swift in Sources */,
A98FA65B2FF3B29700D50212 /* EmojiTableView.swift in Sources */,
A9FB3EE32FA7AB3A00030E2A /* UIKitGifView.swift in Sources */, A9FB3EE32FA7AB3A00030E2A /* UIKitGifView.swift in Sources */,
A9C52F7A2F89BB0800078588 /* EmojiTableViewCell.swift in Sources */, A9C52F7A2F89BB0800078588 /* EmojiTableViewCell.swift in Sources */,
A957C1752ECCE2CE00EA3EE9 /* SettingsView.swift in Sources */, A957C1752ECCE2CE00EA3EE9 /* SettingsView.swift in Sources */,
+31 -19
View File
@@ -7,26 +7,38 @@
import SwiftUI import SwiftUI
//@main
//struct StickerSlackApp: App {
// @ObservedObject var emojiHoarder: EmojiHoarder = EmojiHoarder()
// @ObservedObject var gifhoarder: GifHoarder = GifHoarder()
//
// @State var importingEmojiPack: Bool = false
// @State var pack: EmojiPack = .new()
//
// var body: some Scene {
// WindowGroup {
// ContentView(emojiHoarder: emojiHoarder, gifhoarder: gifhoarder)
// .onOpenURL { url in
// if let imported = EmojiPack(fromShareLink: url) {
// importingEmojiPack = true
// pack = imported
// }
// }
// .sheet(isPresented: $importingEmojiPack) {
// EmojiPackImporterView(emojiHoarder: emojiHoarder, pack: $pack)
// }
// }
// }
//}
@main @main
struct StickerSlackApp: App { class AirAPApp: UIResponder, UIApplicationDelegate {
@ObservedObject var emojiHoarder: EmojiHoarder = EmojiHoarder() var window: UIWindow?
@ObservedObject var gifhoarder: GifHoarder = GifHoarder()
@State var importingEmojiPack: Bool = false func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]?) -> Bool {
@State var pack: EmojiPack = .new() window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = TabbedContentView()
var body: some Scene { window?.makeKeyAndVisible()
WindowGroup { return true
ContentView(emojiHoarder: emojiHoarder, gifhoarder: gifhoarder)
.onOpenURL { url in
if let imported = EmojiPack(fromShareLink: url) {
importingEmojiPack = true
pack = imported
}
}
.sheet(isPresented: $importingEmojiPack) {
EmojiPackImporterView(emojiHoarder: emojiHoarder, pack: $pack)
}
}
} }
} }
+1 -1
View File
@@ -25,7 +25,7 @@ struct BrowseView: View {
Group { Group {
switch browseWhat { switch browseWhat {
case .slackEmoji: case .slackEmoji:
EmojiTableView( EmojiTableViewRepresentable(
hoarder: emojiHoarder, hoarder: emojiHoarder,
items: emojiHoarder.emojis.map { $0.name } items: emojiHoarder.emojis.map { $0.name }
) )
+2 -9
View File
@@ -45,17 +45,10 @@ struct ContentView: View {
Tab(value: AppTab.search, role: .search) { Tab(value: AppTab.search, role: .search) {
NavigationStack { NavigationStack {
SearchView(hoarder: emojiHoarder, searchTerm: $searchTerm) SearchView(hoarder: emojiHoarder)
} }
} }
} }
// .tabViewBottomAccessorySafe() {
// HStack {
// Image(systemName: "magnifyingglass")
// TextField("", text: $searchTerm, prompt: Text("Search"))
// }
// .padding(.horizontal)
// }
} else { } else {
TabView(selection: $tabSelection) { TabView(selection: $tabSelection) {
BrowseView(emojiHoarder: emojiHoarder, gifHoarder: gifhoarder) BrowseView(emojiHoarder: emojiHoarder, gifHoarder: gifhoarder)
@@ -79,7 +72,7 @@ struct ContentView: View {
Label("Setings", systemImage: "gear") Label("Setings", systemImage: "gear")
} }
NavigationView2 { NavigationView2 {
SearchView(hoarder: emojiHoarder, searchTerm: $searchTerm) SearchView(hoarder: emojiHoarder)
} }
.tag(AppTab.search) .tag(AppTab.search)
.tabItem { .tabItem {
@@ -12,8 +12,6 @@ struct EmojiPackDetailView: View {
@ObservedObject var hoarder: EmojiHoarder @ObservedObject var hoarder: EmojiHoarder
@Binding var pack: EmojiPack @Binding var pack: EmojiPack
@State var searchTerm: String = ""
@State var edit: Bool = false @State var edit: Bool = false
@State var editName: Bool = false @State var editName: Bool = false
@State var editDescription: Bool = false @State var editDescription: Bool = false
@@ -111,7 +109,6 @@ struct EmojiPackDetailView: View {
NavigationView2 { NavigationView2 {
SearchView( SearchView(
hoarder: hoarder, hoarder: hoarder,
searchTerm: $searchTerm,
fromPackEditor: true, fromPackEditor: true,
callback: { callback: {
pack.add($0) pack.add($0)
@@ -15,7 +15,6 @@ struct EmojiPackGridView: View {
@State var initDate: Date = .now @State var initDate: Date = .now
@State var showAdder: Bool = false @State var showAdder: Bool = false
@State var searchTerm: String = ""
@State var showNotFoundAlert: Bool = false @State var showNotFoundAlert: Bool = false
@@ -109,7 +108,7 @@ struct EmojiPackGridView: View {
} }
.sheet(isPresented: $showAdder) { .sheet(isPresented: $showAdder) {
NavigationView2 { NavigationView2 {
SearchView(hoarder: hoarder, searchTerm: $searchTerm, fromPackEditor: true) { selection in SearchView(hoarder: hoarder, fromPackEditor: true) { selection in
withAnimation(.spring) { withAnimation(.spring) {
pack.add(selection) pack.add(selection)
} }
@@ -29,6 +29,12 @@ struct EmojiPackManager: View {
Text(pack.name) Text(pack.name)
} }
.swipeActions(edge: .trailing) { .swipeActions(edge: .trailing) {
Button {
hoarder.removeEmojiPack(pack)
} label: {
Label("Delete", systemImage: "trash")
}
.tint(.red)
if #available(iOS 16, *) { if #available(iOS 16, *) {
ShareLink(item: pack.shareLink()) ShareLink(item: pack.shareLink())
} else { } else {
@@ -41,12 +47,6 @@ struct EmojiPackManager: View {
ShareSheet(activityItems: [pack.shareLink()]) ShareSheet(activityItems: [pack.shareLink()])
} }
} }
Button {
hoarder.removeEmojiPack(pack)
} label: {
Label("Delete", systemImage: "trash")
}
.tint(.red)
} }
} }
} }
+2 -3
View File
@@ -12,7 +12,7 @@ struct SearchView: View {
@FocusState private var searchFocused: Bool @FocusState private var searchFocused: Bool
@State private var currentSearch: Task<Void, Never>? @State private var currentSearch: Task<Void, Never>?
@Binding var searchTerm: String @State var searchTerm: String = ""
@State var previousSearches: [String] = [] @State var previousSearches: [String] = []
@State var searchResult: [String] = [] @State var searchResult: [String] = []
@@ -69,7 +69,7 @@ struct SearchView: View {
switch stickerType { switch stickerType {
case .slackEmoji: case .slackEmoji:
Text("\(searchResult.count)") Text("\(searchResult.count)")
EmojiTableView(hoarder: hoarder, items: searchResult) EmojiTableViewRepresentable(hoarder: hoarder, items: searchResult)
.padding(.bottom, 10) .padding(.bottom, 10)
case .giphyGifs: case .giphyGifs:
Text("uhh") Text("uhh")
@@ -100,7 +100,6 @@ struct SearchView: View {
SearchView( SearchView(
hoarder: EmojiHoarder(localOnly: true), hoarder: EmojiHoarder(localOnly: true),
searchTerm: $searchTerm,
fromPackEditor: true fromPackEditor: true
) { ) {
print($0) print($0)
+1 -1
View File
@@ -116,7 +116,7 @@ struct TrieTestingView: View {
} }
if uikit { if uikit {
EmojiTableView(hoarder: hoarder, items: searchResults) EmojiTableViewRepresentable(hoarder: hoarder, items: searchResults)
.animation(.snappy, value: searchResults) .animation(.snappy, value: searchResults)
} else { } else {
List(searchResults, id: \.self) { item in List(searchResults, id: \.self) { item in
+23 -14
View File
@@ -12,6 +12,18 @@ import SwiftUI
final class TabbedContentView: UITabBarController { final class TabbedContentView: UITabBarController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
self.edgesForExtendedLayout = .bottom
self.extendedLayoutIncludesOpaqueBars = false
if #available(iOS 26, *) {
let appearance = UITabBarAppearance()
appearance.configureWithDefaultBackground()
tabBar.standardAppearance = appearance
tabBar.scrollEdgeAppearance = appearance
} else {
self.tabBarController?.tabBar.isTranslucent = false
}
setupTabs() setupTabs()
} }
@@ -19,30 +31,27 @@ final class TabbedContentView: UITabBarController {
let emojiHoarder = EmojiHoarder() let emojiHoarder = EmojiHoarder()
let gifHoarder = GifHoarder() let gifHoarder = GifHoarder()
let browseView = BrowseView(emojiHoarder: emojiHoarder, gifHoarder: gifHoarder) let browseView = EmojiTableView(hoarder: emojiHoarder, items: emojiHoarder.emojis.map { $0.name })
let browse = UIHostingController(rootView: browseView) let browse = UINavigationController(rootViewController: browseView)
browse.tabBarItem = UITabBarItem(title: "Home", image: UIImage(systemName: "house"), tag: 0) browseView.navigationItem.title = "Browse"
browse.tabBarItem = UITabBarItem(title: "Browse", image: UIImage(systemName: "square.grid.2x2.fill"), tag: 0)
let packsView = EmojiPackManager(hoarder: emojiHoarder) let packsView = EmojiPackManager(hoarder: emojiHoarder)
let packs = UIHostingController(rootView: packsView) let packs = UIHostingController(rootView: packsView)
packs.tabBarItem = UITabBarItem(title: "Packs", image: UIImage(systemName: "house"), tag: 1) packs.tabBarItem = UITabBarItem(title: "Packs", image: UIImage(systemName: "square.stack.3d.up.fill"), tag: 1)
let downloadedView = DownloadedView(emojiHoarder: emojiHoarder, gifHoarder: gifHoarder) let downloadedView = DownloadedView(emojiHoarder: emojiHoarder, gifHoarder: gifHoarder)
let downloaded = UIHostingController(rootView: downloadedView) let downloaded = UIHostingController(rootView: downloadedView)
downloaded.tabBarItem = UITabBarItem(title: "Downloaded", image: UIImage(systemName: "house"), tag: 2) downloaded.tabBarItem = UITabBarItem(title: "Downloaded", image: UIImage(systemName: "arrow.down.circle.fill"), tag: 2)
let settingsView = SettingsView(hoarder: emojiHoarder) let settingsView = SettingsView(hoarder: emojiHoarder)
let settings = UIHostingController(rootView: settingsView) let settings = UIHostingController(rootView: settingsView)
settings.tabBarItem = UITabBarItem(title: "Home", image: UIImage(systemName: "house"), tag: 3) settings.tabBarItem = UITabBarItem(title: "Settings", image: UIImage(systemName: "gear"), tag: 3)
self.setViewControllers([browse], animated: true) let searchView = SearchView(hoarder: emojiHoarder)
selectedIndex = 0 let search = UIHostingController(rootView: searchView)
search.tabBarItem = UITabBarItem(tabBarSystemItem: .search, tag: 4)
self.setViewControllers([browse, packs, downloaded, settings, search], animated: false)
} }
} }
@available(iOS 17, *)
#Preview {
let view2 = TabbedContentView()
return view2.view
}
@@ -2,45 +2,13 @@
// EmojiTableView.swift // EmojiTableView.swift
// StickerSlack // StickerSlack
// //
// Created by neon443 on 03/11/2025. // Created by neon443 on 30/06/2026.
// //
import Foundation import Foundation
import UIKit import UIKit
import SwiftUI
import Haptics
struct EmojiTableView: UIViewRepresentable { final class EmojiTableView: UITableViewController {
let hoarder: EmojiHoarder
let items: [String]
func makeUIView(context: Context) -> UITableView {
let tableView = context.coordinator as UITableViewController
tableView.tableView.register(EmojiTableViewCell.self, forCellReuseIdentifier: "cell")
return tableView.tableView
}
func updateUIView(_ uiView: UITableView, context: Context) {
context.coordinator.hoarder = hoarder
let itemsBefore = context.coordinator.items
let itemsAfter = items
context.coordinator.items = items
Task.detached {
//if its being cleared or removign 10k+
guard !itemsAfter.isEmpty && itemsBefore.count-itemsAfter.count < 10_000 else {
await context.coordinator.instantApplySnapshot()
return
}
await context.coordinator.applySnapshot(animated: true)
}
}
func makeCoordinator() -> Coordinator {
Coordinator(hoarder: hoarder, items: items)
}
final class Coordinator: UITableViewController {
var dataSource: UITableViewDiffableDataSource<Int, String>! var dataSource: UITableViewDiffableDataSource<Int, String>!
var hoarder: EmojiHoarder var hoarder: EmojiHoarder
var items: [String] var items: [String]
@@ -53,12 +21,28 @@ struct EmojiTableView: UIViewRepresentable {
return self.cell(tableView, indexPath: indexPath, forItemIdentifier: itemIdentifier) return self.cell(tableView, indexPath: indexPath, forItemIdentifier: itemIdentifier)
} }
tableView.dataSource = dataSource tableView.dataSource = dataSource
tableView.register(EmojiTableViewCell.self, forCellReuseIdentifier: "cell")
self.refreshUI(with: items)
} }
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
func refreshUI(with newItems: [String]) {
let itemsBefore = self.items
let itemsAfter = newItems
self.items = newItems
Task.detached {
//if its being cleared or removign 10k+
guard !itemsAfter.isEmpty && itemsBefore.count-itemsAfter.count < 10_000 else {
await self.instantApplySnapshot()
return
}
await self.applySnapshot(animated: true)
}
}
func makeSnapshot() -> NSDiffableDataSourceSnapshot<Int, String> { func makeSnapshot() -> NSDiffableDataSourceSnapshot<Int, String> {
var snapshot = NSDiffableDataSourceSnapshot<Int, String>() var snapshot = NSDiffableDataSourceSnapshot<Int, String>()
snapshot.appendSections([0]) snapshot.appendSections([0])
@@ -122,5 +106,4 @@ struct EmojiTableView: UIViewRepresentable {
override func tableView(_ tableView: UITableView, shouldBeginMultipleSelectionInteractionAt indexPath: IndexPath) -> Bool { override func tableView(_ tableView: UITableView, shouldBeginMultipleSelectionInteractionAt indexPath: IndexPath) -> Bool {
return true return true
} }
}
} }
@@ -0,0 +1,30 @@
//
// EmojiTableView.swift
// StickerSlack
//
// Created by neon443 on 03/11/2025.
//
import Foundation
import UIKit
import SwiftUI
import Haptics
struct EmojiTableViewRepresentable: UIViewRepresentable {
let hoarder: EmojiHoarder
let items: [String]
func makeUIView(context: Context) -> UITableView {
let tableView = context.coordinator as UITableViewController
return tableView.tableView
}
func updateUIView(_ uiView: UITableView, context: Context) {
context.coordinator.hoarder = hoarder
context.coordinator.refreshUI(with: items)
}
func makeCoordinator() -> EmojiTableView {
return EmojiTableView(hoarder: hoarder, items: items)
}
}
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.