Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RxRIBs: Multiplatform architecture with Rx

VCNC
November 06, 2018

RxRIBs: Multiplatform architecture with Rx

RxRIBs
Multiplatform architecture with rx

VCNC

November 06, 2018
Tweet

More Decks by VCNC

Other Decks in Programming

Transcript

  1. Table of Contents 1 Why a new architecture? 2 RIBs

    at Uber 3 What we got from RIBs 4 RIBs at VCNC
  2. Why a new architecture? Project started 2018.06 Driver α 2018.07

    2018.08 2018.09 2018.10 Rider α Beta Public release
  3. Factors to consider No MVC (no MVVM or MVP, too)

    - MVC stands for Massive View Controller - Keeping components simple Single Activity Application - We’re making a map-based application No time to create a framework from scratch - Conductor, Scoop, ReSwift, ReactorKit, Reflex, …
  4. Factors to consider No MVC (no MVVM or MVP, too)

    - MVC stands for Massive View Controller - Keeping components simple Single Activity Application - We’re making a map-based application No time to create a framework from scratch - Conductor, Scoop, ReSwift, ReactorKit, Reflex, …
  5. Factors to consider No MVC (no MVVM or MVP, too)

    - MVC stands for Massive View Controller - Keeping components simple Single Activity Application - We’re making a map-based application No time to create a framework from scratch - Conductor, Scoop, ReSwift, ReactorKit, Reflex, …
  6. Convoluted state machines Change Email Home Screen Menu Search for

    Location Change Vehicle Options Refine Location Request Vehicle Vehicle Matched Receipt On trip Verify Phone Number
  7. State tree Root Main LoggedOut Menu Request Ride LocationEditor Confirm

    Refinement Coupon DroppedOff Card Matched Pending Viewless Viewful Email, PW, ...
  8. RIB tree Root Main LoggedOut Menu Request LocationEditor Confirm Refinement

    Coupon Card Viewless Viewful Ride DroppedOff Matched Pending Email, PW, ...
  9. RIB tree Root Main LoggedOut Menu Request LocationEditor Confirm Refinement

    Coupon Card Viewless Viewful Ride DroppedOff Matched Pending Email, PW, ...
  10. RIB tree Root Main LoggedOut Menu Request LocationEditor Confirm Refinement

    Coupon Card Viewless Viewful Ride DroppedOff Matched Pending Email, PW, ...
  11. RIB tree Root Main LoggedOut Menu Request LocationEditor Confirm Refinement

    Coupon Card Viewless Viewful Ride DroppedOff Matched Pending Email, PW, ...
  12. RIB tree Root Main LoggedOut Menu Request LocationEditor Confirm Refinement

    Coupon Card Viewless Viewful Ride DroppedOff Matched Pending Email, PW, ...
  13. RIB tree Root Main LoggedOut Menu Request LocationEditor Confirm Refinement

    Coupon Card Viewless Viewful Ride DroppedOff Matched Pending Email, PW, ...
  14. RIB tree Root Main LoggedOut Menu Request LocationEditor Confirm Refinement

    Coupon Card Viewless Viewful Ride DroppedOff Matched Pending Email, PW, ...
  15. RIB tree Root Main LoggedOut Menu Request LocationEditor Confirm Refinement

    Coupon Card Viewless Viewful Ride DroppedOff Matched Pending Email, PW, ...
  16. Scopes class AuthenticateNetworkRequest: NetworkRequest { private var authToken: String? public

    func makeRequest() { if let authToken = authToken { addAuthToken(authToken) } super.makeRequest() }
  17. Scopes // `authToken` is not null in MainScope class AuthenticateNetworkRequest:

    NetworkRequest { private var authToken: String public func makeRequest() { addAuthToken(authToken) super.makeRequest() } }
  18. Scopes public func refresh() { if let ride = self.ride

    { getRideStatus(ride.id) } else { getUserStatus(self.user!.id) } }
  19. Scopes // `ride` is not null in RideScope public func

    refresh() { getRideStatus(self.ride.id) }
  20. Flow of data (Uber RIBs) Interactor (business logic) Presenter (translation

    logic) Router (attach/detach RIBs) View (layout & interaction)
  21. Flow of data (VCNC RIBs) Interactor (business logic) Presenter (translation

    logic) Router (attach/detach RIBs) View (layout & interaction) Events
  22. Animations No consideration in Uber RIBs Need to think about

    RIBs transitions UITransitioningDelegate in UIViewController HeroTransitions func transition(from: UIViewController, to: UIViewController) in view: UIView, completion: ((Bool) -> Void)? = nil)
  23. Wrap-up 1 Multi-platform architecture 2 Router, Inteactor, Builder, Presenter, and

    View 3 Business logic determines the state tree 4 Scopes 5 Unidirectional data flow, Animations, Lifecycle