Taehyeon-Kim / SeSAC

☀️ SeSAC Daily Reporting
27 stars 0 forks source link

[221019] TIL #138

Open Taehyeon-Kim opened 2 years ago

Taehyeon-Kim commented 2 years 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 2 years ago

UIContentConfiguration

ContentConfig

BackgroundConfig

Taehyeon-Kim commented 2 years ago

셀 재사용

Taehyeon-Kim commented 2 years ago
Taehyeon-Kim commented 2 years ago

DiffableDataSource