RxSwiftX
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
- iOS 9.0+
- Swift 4.2
Installation
RxSwiftX is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'RxSwiftX'
Optional
pod 'RxSwiftX/DataSources'
pod 'RxSwiftX/MJRefresh'
Usage
DataSources
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)
Demo
https://github.com/Pircate/RxSwiftDemo
Author
Pircate, [email protected]
License
RxSwiftX is available under the MIT license. See the LICENSE file for more info.