FancySources 1.0.1

FancySources 1.0.1

Sergey Maslov 维护。



  • 作者:
  • Nikolay Ischuk

FancySources

灵活、通用的 UIKit 数据源的学习类

使用示例

typealias DataSourceType = CollectionViewDataSource

func didLoadEntities(entities: [SomeEntities]) {        
    let dataSource = DataSourceType(items: entities)
    fill(with: dataSource)
}

func fill(with dataSource: DataSourceType) {
    dataSource.cellDescriptorCreator = {
        [weak self] item, index in

        return CellDescriptor(nibName: String(describing: SomeGameCell.self), configure: {
            (cell: SomeGameCell) in

            cell.fill(with: item)
            cell.delegate = self
        })
    }
    collectionView.dataSource = dataSource
    collectionView.reloadData()
}