Open Taehyeon-Kim opened 1 year ago
cellRegistration = UICollectionView.CellRegistration { cell, indexPath, itemIdentifier in var content = UIListContentConfiguration.valueCell() content.text = itemIdentifier.title // valueCell에서는 secondaryText가 우측으로 감 // default configuration에서는 secondaryText가 하단으로 감 content.secondaryText = itemIdentifier.emoji content.prefersSideBySideTextAndSecondaryText = false content.textToSecondaryTextVerticalPadding = 10 content.image = indexPath.item < 3 ? UIImage(systemName: "arrowshape.right.fill") : UIImage(systemName: "arrowshape.right") content.imageProperties.tintColor = .darkGray print("setup") cell.contentConfiguration = content }
let cell = collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "cell")
public struct CellRegistration<Cell, Item> where Cell : UICollectionViewCell { public typealias Handler = (_ cell: Cell, _ indexPath: IndexPath, _ itemIdentifier: Item) -> Void public init(handler: @escaping UICollectionView.CellRegistration<Cell, Item>.Handler) public init(cellNib: UINib, handler: @escaping UICollectionView.CellRegistration<Cell, Item>.Handler) }