Taehyeon-Kim / SeSAC

☀️ SeSAC Daily Reporting
27 stars 0 forks source link

[221019] TIL #138

Open Taehyeon-Kim opened 1 year ago

Taehyeon-Kim commented 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)
}
Taehyeon-Kim commented 1 year ago

UIContentConfiguration

ContentConfig

BackgroundConfig

Taehyeon-Kim commented 1 year ago

셀 재사용

Taehyeon-Kim commented 1 year ago
Taehyeon-Kim commented 1 year ago

DiffableDataSource