migrated datasource to tableviewcontroller, disabled selecting cells, set insetgrouped stype

ts lowk mostly works yay
This commit is contained in:
neon443 committed 2026-04-05 00:38:45 +01:00
1 parent 1f937db771
commit 5257c03f49
3 files changed
+32 -10

No files matched your search

+3 -3
View File
@@ -13,9 +13,9 @@ import Haptics
class EmojiHoarder: Hoarder, ObservableObject {
static let container: URL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.neon443.StickerSlack")!.appendingPathComponent("Library", conformingTo: .directory)
nonisolated static let localEmojiDB: URL = EmojiHoarder.container.appendingPathComponent("_localEmojiDB.json", conformingTo: .fileURL)
nonisolated static let localTrie: URL = EmojiHoarder.container.appendingPathComponent("_localTrie.json", conformingTo: .fileURL)
nonisolated static let localTrieDict: URL = EmojiHoarder.container.appendingPathComponent("_localTrieDict.json", conformingTo: .fileURL)
nonisolated static let localEmojiDB: URL = EmojiHoarder.container.appendingPathComponent("_____localEmojiDB.json", conformingTo: .fileURL)
nonisolated static let localTrie: URL = EmojiHoarder.container.appendingPathComponent("_____localTrie.json", conformingTo: .fileURL)
nonisolated static let localTrieDict: URL = EmojiHoarder.container.appendingPathComponent("_____localTrieDict.json", conformingTo: .fileURL)
let endpoint: URL = URL(string: "https://cachet.dunkirk.sh/emojis")!
@Published var emojis: [Emoji] = []
+1
View File
@@ -29,6 +29,7 @@ struct SearchView: View {
case .slackEmoji:
EmojiCollectionView(hoarder: hoarder, items: searchResult)
.id(searchResult)
.ignoresSafeArea(edges: .bottom)
case .giphyGifs:
Text("uhh")
}
+28 -7
View File
@@ -15,10 +15,12 @@ struct EmojiCollectionView: UIViewRepresentable {
let items: [String]
func makeUIView(context: Context) -> UITableView {
let tableView = UITableView()
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
tableView.dataSource = context.coordinator
return tableView
let tableView = context.coordinator as UITableViewController
tableView.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
tableView.tableView.dataSource = context.coordinator
tableView.tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 5, right: 0)
tableView.tableView.separatorStyle = .none
return tableView.tableView
}
func updateUIView(_ uiView: UITableView, context: Context) {
@@ -31,30 +33,49 @@ struct EmojiCollectionView: UIViewRepresentable {
Coordinator(hoarder: hoarder, items: items)
}
final class Coordinator: NSObject, UITableViewDataSource {
final class Coordinator: UITableViewController {
var hoarder: EmojiHoarder
var items: [String]
init(hoarder: EmojiHoarder, items: [String]) {
self.hoarder = hoarder
self.items = items
super.init(style: .insetGrouped)
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let emojiName = items[indexPath.row]
let emoji = hoarder.trie.dict[emojiName]!
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.selectedBackgroundView = nil
cell.selectionStyle = .none
cell.contentConfiguration = UIHostingConfiguration {
StickerRow(hoarder: hoarder, sticker: emoji)
.id(emoji)
}
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
// <#code#>
}
override func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
// <#code#>
}
override func tableView(_ tableView: UITableView, shouldBeginMultipleSelectionInteractionAt indexPath: IndexPath) -> Bool {
return true
}
}
}
//
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.