From 6ac41662830c03280b2c44c7b179e9f6931ff64b Mon Sep 17 00:00:00 2001 From: Nihaal Sharma <69979447+neon443@users.noreply.github.com> Date: Fri, 24 Apr 2026 17:41:06 +0100 Subject: [PATCH] army of spinners --- StickerSlack/UIKit/EmojiCollectionView.swift | 10 ++++++++++ .../UIKit/EmojiCollectionViewCell.swift | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/StickerSlack/UIKit/EmojiCollectionView.swift b/StickerSlack/UIKit/EmojiCollectionView.swift index 5d80834..2c0308a 100644 --- a/StickerSlack/UIKit/EmojiCollectionView.swift +++ b/StickerSlack/UIKit/EmojiCollectionView.swift @@ -44,6 +44,16 @@ struct EmojiCollectionView: UIViewRepresentable { required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return items.count + } + + override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) + + return cell + } } } diff --git a/StickerSlack/UIKit/EmojiCollectionViewCell.swift b/StickerSlack/UIKit/EmojiCollectionViewCell.swift index 7456e0c..2f5174b 100644 --- a/StickerSlack/UIKit/EmojiCollectionViewCell.swift +++ b/StickerSlack/UIKit/EmojiCollectionViewCell.swift @@ -10,5 +10,23 @@ import UIKit import SwiftUI class EmojiCollectionViewCell: UICollectionViewCell { + override init(frame: CGRect) { + super.init(frame: frame) + + let spinner = UIActivityIndicatorView() + spinner.frame = frame + spinner.startAnimating() + self.contentView.addSubview(spinner) + spinner.translatesAutoresizingMaskIntoConstraints = false + NSLayoutConstraint.activate([ + spinner.topAnchor.constraint(equalTo: contentView.topAnchor), + spinner.bottomAnchor.constraint(equalTo: contentView.bottomAnchor), + spinner.leadingAnchor.constraint(equalTo: contentView.leadingAnchor), + spinner.trailingAnchor.constraint(equalTo: contentView.trailingAnchor) + ]) + } + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } }