iamchiwon / RxTodo

iOS Todo Application using Reactive Architecture

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RxTodo

Swift Build Status

RxTodo is an iOS application developed using The Reactive Architecture. This project is for whom having trouble with learning how to build a RxSwift application due to lack of references. (as I did 😛)

Features

Philosophy

  • View doesn't have control flow. View cannot modify the data. View only knows how to map the data.

    Bad

    viewReactor.titleLabelText
      .map { $0 + "!" } // Bad: View should not modify the data
      .bindTo(self.titleLabel)

    Good

    viewReactor.titleLabelText
      .bindTo(self.titleLabel.rx.text)
  • View doesn't know what ViewReactor does. View can only communicate to ViewReactor about what View did.

    Bad

    viewReactor.login() // Bad: View should not know what ViewReactor does (login)

    Good

    self.loginButton.rx.tap
      .bindTo(viewReactor.loginButtonDidTap) // "Hey I clicked the login button"
    
    self.usernameInput.rx.controlEvent(.editingDidEndOnExit)
      .bindTo(viewReactor.usernameInputDidReturn) // "Hey I tapped the return on username input"
  • Model is hidden by ViewReactor. ViewReactor only exposes the minimum data so that View can render.

    Bad

    struct ProductViewReactor {
      let product: Driver<Product> // Bad: ViewReactor should hide Model
    }

    Good

    struct ProductViewReactor {
      let productName: Driver<String>
      let formattedPrice: Driver<String>
      let formattedOriginalPrice: Driver<String>
      let isOriginalPriceHidden: Driver<Bool>
    }

Requirements

  • iOS 8+
  • Swift 3
  • CocoaPods

Screenshots

rxtodo

Contribution

Discussion and pull requests are welcomed 💖

License

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

About

iOS Todo Application using Reactive Architecture

License:MIT License


Languages

Language:Swift 90.3%Language:Ruby 9.7%