Pircate / RxSwiftX

RxSwift 便利性扩展以及 UITableViewDelegate 扩展

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RxSwiftX

CI Status Version Carthage compatible License platforms

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, gao497868860@163.com

License

RxSwiftX is available under the MIT license. See the LICENSE file for more info.

About

RxSwift 便利性扩展以及 UITableViewDelegate 扩展

License:MIT License


Languages

Language:Swift 96.6%Language:Ruby 3.4%