When looking at code in documentation, registration is done differently, by creating a default content configuration and then adjusting:
let cellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, Int> { cell, indexPath, item in
var contentConfiguration = cell.defaultContentConfiguration()
contentConfiguration.text = "\(item)"
contentConfiguration.textProperties.color = .lightGray
cell.contentConfiguration = contentConfiguration
}
Could you also test with a log:
let mainCellRegistration = UICollectionView.CellRegistration<EmotionExplorerCell, Item> { cell, indexPath, item in
print("cell", cell, indexPath, item) // <<-- ADD THIS
switch item {
case .main(emotion: let emotion, icon: let iconName, red: let red, green: let green, blue: let blue) :
cell.configure(iconName: iconName, title: emotion, red: red, green: green, blue: blue)
cell.index = indexPath.row
cell.delegate = self
case .title(title: -, buttonTitle: