Latest 0.5.0
Homepage https://github.com/devxoul/SectionReactor
License MIT
Platforms ios 8.0, tvos 9.0
Dependencies ReactorKit, RxDataSources
Frameworks Foundation
Authors

Swift
CocoaPods
Build Status
Codecov

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 example.

ArticleViewSection.swift

enum ArticleViewSection: SectionModelType {
  case article(ArticleSectionReactor)

  var items: [ArticleViewSection] {
    switch self {
    case let .article(sectionReactor):
      return sectionReactor.currentState.sectionItems
    }
  }
}

ArticleSectionReactor.swift

import SectionReactor

final class ArticleSectionItem: SectionReactor {
  struct State: SectionReactorState {
    var sectionItems: [ArticleSectionItem]
  }
}

ArticleListViewReactor.swift

final class ArticleListViewReactor: Reactor {
  struct State {
    var articleSectionReactors: [ArticleSectionReactor]
    var sections: [ArticleViewSection] {
      return self.articleSectionReactors.map(ArticleViewSection.article)
    }
  }

  func transform(state: Observable<State>) -> Observable<State> {
    return state.merge(sections: [
      { $0.articleSectionReactors },
    ])
  }
}

Dependencies

Installation

pod 'SectionReactor'

License

SectionReactor is under MIT license. See the LICENSE for more info.

Latest podspec

{
    "name": "SectionReactor",
    "version": "0.5.0",
    "summary": "A ReactorKit extension for managing table view and collection view sections with RxDataSources.",
    "homepage": "https://github.com/devxoul/SectionReactor",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Suyeol Jeon": "[email protected]"
    },
    "source": {
        "git": "https://github.com/devxoul/SectionReactor.git",
        "tag": "0.5.0"
    },
    "source_files": "Sources/**/*.{swift,h,m}",
    "frameworks": "Foundation",
    "dependencies": {
        "ReactorKit": [],
        "RxDataSources": []
    },
    "platforms": {
        "ios": "8.0",
        "tvos": "9.0"
    }
}

Pin It on Pinterest

Share This