diff --git a/StickerSlack/UIKit/CollectionView/PlainEmojiCollectionViewCell.swift b/StickerSlack/UIKit/CollectionView/PlainEmojiCollectionViewCell.swift index 01b186b..80e7aae 100644 --- a/StickerSlack/UIKit/CollectionView/PlainEmojiCollectionViewCell.swift +++ b/StickerSlack/UIKit/CollectionView/PlainEmojiCollectionViewCell.swift @@ -73,12 +73,13 @@ class PlainEmojiCollectionViewCell: UICollectionViewCell { let totalWidth = collectionView.bounds.width let availWidth = totalWidth-collectionView.contentInset.left-collectionView.contentInset.right - let cols: CGFloat + var cols: CGFloat if style == .jumboMoji { cols = width } else { cols = max(1, floor(availWidth/width)) } + if cols == 0 || cols == .infinity { cols = 4 } let totalSpacing = ((collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.minimumInteritemSpacing ?? 0) * (cols-1) let itemWidth = ((availWidth-totalSpacing)/cols).rounded(.down) layoutAttributes.size = CGSize(width: itemWidth, height: itemWidth) diff --git a/StickerSlack/UIKit/EmojiPackDetailViewRepresentable.swift b/StickerSlack/UIKit/EmojiPackDetailViewRepresentable.swift index f1a1419..3b98254 100644 --- a/StickerSlack/UIKit/EmojiPackDetailViewRepresentable.swift +++ b/StickerSlack/UIKit/EmojiPackDetailViewRepresentable.swift @@ -10,18 +10,16 @@ import UIKit import SwiftUI struct EmojiPackDetailViewRepresentable: UIViewControllerRepresentable { - typealias UIViewControllerType = UINavigationController - var hoarder: EmojiHoarder var pack: EmojiPack - func makeUIViewController(context: Context) -> UINavigationController { + func makeUIViewController(context: Context) -> UIViewController { let view = EmojiPackDetailViewController(with: hoarder, andPack: pack) - view.isToolbarHidden = false + view.navigationController?.isToolbarHidden = false return view } - func updateUIViewController(_ uiViewController: UINavigationController, context: Context) { + func updateUIViewController(_ uiViewController: UIViewController, context: Context) { } }