Оба значения titleLabel
и deviceImageView
находятся в MyCell
, но вы загружаете UICollectionViewCell
по умолчанию.
Вам необходимо привести тип collectionCell к MyCell
. Используйте оператор guard
, если не удается загрузить MyCell
:
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellIdentifier, for: indexPath) as? MyCell else { fatalError("can not load MyCell") }
cell.titleLabel.text = cellType.properties.titleText
cell.deviceImageView.image = cellType.properties.image
return cell
}