RxSwiftX
示例
要运行示例项目,请先克隆仓库,然后在 Example 目录中运行 pod install
。
系统要求
- iOS 9.0+
- Swift 4.2
安装
RxSwiftX 通过 CocoaPods 提供。要安装它,只需简单地添加以下行到您的 Podfile 中
pod 'RxSwiftX'
可选
pod 'RxSwiftX/DataSources'
pod 'RxSwiftX/MJRefresh'
使用方法
数据源
private lazy var proxy: RxTableViewSectionedReloadProxy<TodoSectionModel> = {
RxTableViewSectionedReloadProxy<TodoSectionModel>(configureCell: { (_, tableView, indexPath, item) -> UITableViewCell in
let cell = tableView.dequeueReusableCell(withIdentifier: "cellID", for: indexPath) as! TodoItemCell
cell.bindViewModel(item)
return cell
}, canEditRowAtIndexPath: { _, _ in
return true
}, canMoveRowAtIndexPath: { _, _ in
return true
}, heightForRowAtIndexPath: { _, _, item in
return 60
}, heightForHeaderInSection: { _, _ -> CGFloat in
return 50
}, viewForHeaderInSection: { _, _, _ -> UIView? in
return UILabel().chain.text("云推荐").textAlignment(.center).build
})
}()
// Bind to proxy not dataSource
items.drive(tableView.rx.items(proxy: proxy)).disposed(by: disposeBag)
演示
https://github.com/Pircate/RxSwiftDemo
作者
Pircate,[email protected]
许可证
RxSwiftX在MIT许可证下可用。查看LICENSE文件以获取更多信息。