I use the storyboard with UICollectionViewCell. Does dequeueConfiguredReusableCell not support storyboard?
let itemCell = UICollectionView.CellRegistration<ItemCollectionViewCell, OrderCollectionModel>() { cell, indexPath, model in
//Crash!!
cell.menuLabel.text = model.item?.ingredient
}
class ItemCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var oraderButton: UIButton!
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var menuLabel: UILabel!
@IBOutlet weak var descriptionLabel: UILabel!
@IBOutlet weak var ingredientLabel: UILabel!
override init(frame: CGRect) {
super.init(frame: frame)
}
override func awakeFromNib() {
super.awakeFromNib()
}
required init?(coder: NSCoder) {
fatalError("Fatal Error")
}
}
collectionView.dequeueConfiguredReusableCell(
using: itemCell,
for: indexPath,
item: model
)
let itemCell = UICollectionView.CellRegistration<ItemCollectionViewCell, OrderCollectionModel>() { cell, indexPath, model in
//Crash!!
cell.menuLabel.text = model.item?.ingredient
}
class ItemCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var oraderButton: UIButton!
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var menuLabel: UILabel!
@IBOutlet weak var descriptionLabel: UILabel!
@IBOutlet weak var ingredientLabel: UILabel!
override init(frame: CGRect) {
super.init(frame: frame)
}
override func awakeFromNib() {
super.awakeFromNib()
}
required init?(coder: NSCoder) {
fatalError("Fatal Error")
}
}
collectionView.dequeueConfiguredReusableCell(
using: itemCell,
for: indexPath,
item: model
)