DataDrivenRxDatasources - MVVM abstraction boilerplate code over RxDataSources.
The standard approach to managing table/collection views with data sources has several flaws:
RxDataSources helps us to solve some of this problem with an elegant data binding mechanism and powerful AnimatableSectionModel & SectionModel abstractions, but still stays us on our own with repeatable cell registration and violation of dependency inversion principle.
DataDrivenRxDatasources brings another level of the abstractions and lets us address these issues and design a data-driven, reusable, declarative table/collection view components which depends only on its ViewModel. The core of our library is based on abstracted protocols that are supposed to provide binding sections and cells but don’t care what these sections and cells really are. More info on Medium
Swift Package Manager by url: https://github.com/bigMOTOR/DataDrivenRxDatasources.git
Podfile: pod 'DataDrivenRxDatasources'
private typealias SectionViewModel = AnimatableTableSectionModel<String>
let cellItems = [
SampleCellViewModel(name: "Name 1"),
SampleCellViewModel(name: "Name 2")
]
let sections: Driver<[AnimatableTableSectionModel<String>]> = .just([SectionViewModel(model: "Some Section", items: cellItems)])
tableView.rx
.bind(sections: sections)
.disposed(by: bag)
Please take a look at our ‘Example’ project to get more use cases.
DataDrivenRxDatasources requires iOS11, RxDataSources 5.x and RxSwift 6.x. For the last iOS10 support, please use DataDrivenRxDatasources 2.1.0. For the last RxSwift 5.x support, please use DataDrivenRxDatasources 1.2.0.
DataDrivenRxDatasources is available under the MIT license. See the LICENSE file for more info.
link |
Stars: 13 |
Last commit: 42 weeks ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics