https://github.com/devxoul/sectionreactor
A ReactorKit extension for managing table view and collection view sections with RxDataSources
https://github.com/devxoul/sectionreactor
collectionview reactorkit rxdatasources sectionreactor tableview
Last synced: 3 months ago
JSON representation
A ReactorKit extension for managing table view and collection view sections with RxDataSources
- Host: GitHub
- URL: https://github.com/devxoul/sectionreactor
- Owner: devxoul
- License: mit
- Created: 2017-09-09T03:42:56.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-06-15T06:15:01.000Z (about 6 years ago)
- Last Synced: 2025-03-18T08:53:27.686Z (3 months ago)
- Topics: collectionview, reactorkit, rxdatasources, sectionreactor, tableview
- Language: Swift
- Size: 60.5 KB
- Stars: 46
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SectionReactor

[](https://cocoapods.org/pods/SectionReactor)
[](https://travis-ci.org/devxoul/SectionReactor)
[](https://codecov.io/gh/devxoul/SectionReactor)SectionReactor is a ReactorKit extension for managing table view and collection view sections with RxDataSources.
## Getting Started
This is a draft. I have no idea how would I explain this concept 🤦♂️ It would be better to see the [ArticleFeed](https://github.com/devxoul/SectionReactor/tree/master/Examples/ArticleFeed) example.
**ArticleViewSection.swift**
```swift
enum ArticleViewSection: SectionModelType {
case article(ArticleSectionReactor)var items: [ArticleViewSection] {
switch self {
case let .article(sectionReactor):
return sectionReactor.currentState.sectionItems
}
}
}
```**ArticleSectionReactor.swift**
```swift
import SectionReactorfinal class ArticleSectionItem: SectionReactor {
struct State: SectionReactorState {
var sectionItems: [ArticleSectionItem]
}
}
```**ArticleListViewReactor.swift**
```swift
final class ArticleListViewReactor: Reactor {
struct State {
var articleSectionReactors: [ArticleSectionReactor]
var sections: [ArticleViewSection] {
return self.articleSectionReactors.map(ArticleViewSection.article)
}
}func transform(state: Observable) -> Observable {
return state.merge(sections: [
{ $0.articleSectionReactors },
])
}
}
```## Dependencies
* [ReactorKit](https://github.com/ReactorKit/ReactorKit) >= 0
* [RxDataSources](https://github.com/RxSwiftCommunity/RxDataSources) >= 2.0## Installation
```ruby
pod 'SectionReactor'
```## License
SectionReactor is under MIT license. See the [LICENSE](LICENSE) for more info.