Skip to content

conform to 'RxCollectionViewDataSourceType' #376

Open
@zhangyuepeng86

Description

@zhangyuepeng86

I am a stranger to RxDataSources,when I set the datasource to UICollectionView, got the error:
Instance method 'items(dataSource:)' requires that 'CollectionViewSectionedDataSource<NoticeList>' conform to 'RxCollectionViewDataSourceType'

code:

let dataSource = RxCollectionViewSectionedReloadDataSource<NoticeList> { (dataSource, collectionView, indexPath, model) -> UICollectionViewCell in
            let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell",
                                              for: indexPath) as! ListCollectionViewCell
            cell.titleLabel.text = model.title
            cell.numberLabel.text = String(indexPath.row)
            
            return cell
        }
...
NoticeListViewModel().data.asDriver(onErrorJustReturn: []).drive(collectionView.rx.items(dataSource: dataSource)).disposed(by:disposeBag)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions