RxCollectionExtensions
安装
RxCollectionExtensions 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile:
绑定到 TableView
self.viewModel.items
// .asObservable()
.bind(toTableView: self.tableView, cellIdentifier: Cells.default, cellType: UITableViewCell.self, disposeBag: self.disposeBag) { (index, row, cell) in
cell.textLabel?.text = row.name;
}
绑定到 CollectionView
self.viewModel.items
// .asObservable()
.bind(toCollectionView: self.collectionView, cellIdentifier: Cells.default, cellType: CollectionViewCell.self, disposeBag: self.disposeBag) { (index, row, cell) in
cell.label?.text = row.name;
}
示例
要运行示例项目,请首先克隆仓库,然后从 Example 目录运行 pod install
。
需求
RxSwift, RxCocoa
pod 'RxCollectionExtensions'
作者
2sem, [email protected]
许可
RxCollectionExtensions 在MIT许可下可用。更多信息请参阅LICENSE文件。