working emojicollectionview

added a menu to add to a pack from stickerrow
reorg uikit stuff
This commit is contained in:
neon443 committed 2026-04-26 14:37:21 +01:00
1 parent 1951eccf36
commit ca3f42b398
8 files changed
+165 -61

No files matched your search

@@ -0,0 +1,77 @@
//
// EmojiTableView.swift
// StickerSlack
//
// Created by neon443 on 03/11/2025.
//
import Foundation
import UIKit
import SwiftUI
import Haptics
struct EmojiTableView: UIViewRepresentable {
let hoarder: EmojiHoarder
let items: [String]
func makeUIView(context: Context) -> UITableView {
let tableView = context.coordinator as UITableViewController
tableView.tableView.register(EmojiTableViewCell.self, forCellReuseIdentifier: "cell")
tableView.tableView.dataSource = context.coordinator
return tableView.tableView
}
func updateUIView(_ uiView: UITableView, context: Context) {
context.coordinator.hoarder = hoarder
context.coordinator.items = items
uiView.reloadData()
}
func makeCoordinator() -> Coordinator {
Coordinator(hoarder: hoarder, items: items)
}
final class Coordinator: UITableViewController {
var hoarder: EmojiHoarder
var items: [String]
init(hoarder: EmojiHoarder, items: [String]) {
self.hoarder = hoarder
self.items = items
super.init(style: .plain)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! EmojiTableViewCell
cell.selectionStyle = .none
guard !hoarder.trie.dict.isEmpty else { return cell }
let emojiName = items[indexPath.row]
guard let emoji = hoarder.trie.dict[emojiName] else { return cell }
cell.configure(with: hoarder, emoji: 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.