Видя следующее исключение
'UICollectionView must be initialized with a non-nil layout parameter'
с этим ViewController
import UIKit
class SelectDesignController: UICollectionViewController, UICollectionViewDelegateFlowLayout {
private let designCellId = "designCellId"
override func viewDidLoad() {
super.viewDidLoad()
configureNavBar()
configureUI()
collectionView.backgroundColor = #colorLiteral(red: 0.8515156507, green: 0.9521961808, blue: 0.9503603578, alpha: 1)
collectionView.register(DesignCategoryCell.self, forCellWithReuseIdentifier: designCellId)
}
@objc func handleDismiss() {
dismiss(animated: true, completion: nil)
}
func configureNavBar() {
navigationItem.leftBarButtonItem = UIBarButtonItem(image: UIImage.fontAwesomeIcon(name: .chevronLeft, style: .solid, textColor: .white, size: CGSize(width: 40, height: 40)).withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(handleDismiss))
}
func configureUI (){
view.backgroundColor = #colorLiteral(red: 0.8515156507, green: 0.9521961808, blue: 0.9503603578, alpha: 1)
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: designCellId, for: indexPath) as! DesignCategoryCell
return cell
}
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 1
}
/** PROVIDING a LAYOUT HERE **/
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: view.frame.width, height: view.frame.height)
}
}
Я включаю SelectDesignController
следующим образом:
let controller = SelectDesignController()
let nav = UINavigationController(rootViewController: controller)
configureNav(nav: nav, title: "Designs")
present(nav, animated: true, completion: nil)
Любая идея,что мне не хватает?