mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
skeleton collectionview
This commit is contained in:
5 files changed
+84
-9
No files matched your search
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// EmojiCollectionView.swift
|
||||
// StickerSlack
|
||||
//
|
||||
// Created by neon443 on 24/04/2026.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
|
||||
struct EmojiCollectionView: UIViewRepresentable {
|
||||
let hoarder: EmojiHoarder
|
||||
let items: [String]
|
||||
|
||||
func makeUIView(context: Context) -> UICollectionView {
|
||||
let collectionView = context.coordinator as UICollectionViewController
|
||||
collectionView.collectionView.register(EmojiCollectionViewCell.self, forCellWithReuseIdentifier: "cell")
|
||||
collectionView.collectionView.dataSource = context.coordinator
|
||||
return collectionView.collectionView
|
||||
}
|
||||
|
||||
func updateUIView(_ uiView: UICollectionView, context: Context) {
|
||||
context.coordinator.hoarder = hoarder
|
||||
context.coordinator.items = items
|
||||
uiView.reloadData()
|
||||
}
|
||||
|
||||
func makeCoordinator() -> Coordinator {
|
||||
Coordinator(hoarder: hoarder, items: items)
|
||||
}
|
||||
|
||||
final class Coordinator: UICollectionViewController {
|
||||
var hoarder: EmojiHoarder
|
||||
var items: [String]
|
||||
|
||||
init(hoarder: EmojiHoarder, items: [String]) {
|
||||
self.hoarder = hoarder
|
||||
self.items = items
|
||||
|
||||
super.init(collectionViewLayout: UICollectionViewFlowLayout())
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// EmojiCollectionViewCell.swift
|
||||
// StickerSlack
|
||||
//
|
||||
// Created by neon443 on 24/04/2026.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
|
||||
class EmojiCollectionViewCell: UICollectionViewCell {
|
||||
|
||||
}
|
||||
@@ -16,7 +16,7 @@ struct EmojiTableView: UIViewRepresentable {
|
||||
|
||||
func makeUIView(context: Context) -> UITableView {
|
||||
let tableView = context.coordinator as UITableViewController
|
||||
tableView.tableView.register(EmojiCell.self, forCellReuseIdentifier: "cell")
|
||||
tableView.tableView.register(EmojiTableViewCell.self, forCellReuseIdentifier: "cell")
|
||||
tableView.tableView.dataSource = context.coordinator
|
||||
return tableView.tableView
|
||||
}
|
||||
@@ -50,7 +50,7 @@ struct EmojiTableView: UIViewRepresentable {
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! EmojiCell
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! EmojiTableViewCell
|
||||
cell.selectionStyle = .none
|
||||
|
||||
guard !hoarder.trie.dict.isEmpty else {
|
||||
|
||||
@@ -9,7 +9,7 @@ import Foundation
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
|
||||
class EmojiCell: UITableViewCell {
|
||||
class EmojiTableViewCell: UITableViewCell {
|
||||
private var spinner: UIActivityIndicatorView = UIActivityIndicatorView(style: .large)
|
||||
private var hostingController: UIHostingController<StickerRow<EmojiHoarder>>?
|
||||
|
||||