Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

ReactorKit으로 단방향 반응형 앱 만들기

539 views

Published on

let'Swift 17 발표자료입니다.

Published in: Software
  • Be the first to comment

ReactorKit으로 단방향 반응형 앱 만들기

  1. 1. letswift(17) ReactorKit ReactorKit github.com/devxoul
  2. 2. • StyleShare, Inc. • Open Source Lover • Then • URLNavigator • RxSwift • ObjectMapper
  3. 3. letswift(17) Why?
  4. 4. Why? 1. Massive View Controller • •
  5. 5. Why? 1. Massive View Controller • • 2. RxSwift is Awesome • •
  6. 6. Why? : 1. Massive View Controller 2. RxSwift
  7. 7. Why? - Problems RxSwift ? • Rx + MVC? • Rx + MVVM? ⚠ : .
  8. 8. Why? - Problems Cyclic Data Dependencies • • : • nextURL
  9. 9. Why? - Problems Cyclic Data Dependencies • : BehaviorSubject • BehaviorSubject(=Variable) • RxSwift
  10. 10. Why? : 1. Massive View Controller 2. RxSwift
  11. 11. Why? : 1. Massive View Controller 2. RxSwift 3.
  12. 12. letswift(17) ReactorKit
  13. 13. ReactorKit 1. Massive View Controller . ✅ • •
  14. 14. ReactorKit 2. RxSwift . ✅ • ReactorKit RxSwift • RxSwift
  15. 15. ReactorKit 3. . ✅ • • reduce() •
  16. 16. ReactorKit ... • ( ) • • CocoaPods 8800 / 280
  17. 17. ReactorKit ... • ( ) • • CocoaPods 8800 / 280
  18. 18. Basic Concept
  19. 19. Basic Concept • Reactor • Reactor • , , View
  20. 20. Basic Concept protocol View { associatedtype Reactor var disposeBag: DisposeBag // self.reactor func bind(reactor: Reactor) }
  21. 21. Basic Concept protocol StoryboardView { associatedtype Reactor var disposeBag: DisposeBag // func bind(reactor: Reactor) } // Storyboard
  22. 22. Basic Concept • View Action • View • View Reactor
  23. 23. Basic Concept protocol Reactor { associatedtype Action associatedtype Mutation associatedtype State var initialState: State }
  24. 24. Basic Concept
  25. 25. Basic Concept RxSwift
  26. 26. Data Flow
  27. 27. Data Flow
  28. 28. Data Flow Action State • State • Action State Mutation • Mutation State / • Mutation View
  29. 29. Data Flow
  30. 30. Data Flow class ProfileViewReactor: Reactor { enum Action { case follow // } struct State { var isFollowing: Bool // } }
  31. 31. Data Flow class ProfileViewReactor: Reactor { enum Action { case follow // } struct State { var isFollowing: Bool // } } API State
  32. 32. Data Flow class ProfileViewReactor: Reactor { enum Action { case follow // } enum Mutation { case setFollowing(Bool) // } struct State { var isFollowing: Bool // } }
  33. 33. Data Flow (Action) -> Observable<Mutation> (State, Mutation) -> State
  34. 34. Data Flow
  35. 35. Data Flow
  36. 36. Data Flow Action.follow
  37. 37. Data Flow Action.follow
  38. 38. Data Flow UserService.follow()
  39. 39. Data Flow UserService
  40. 40. Data Flow Observable<Bool>
  41. 41. Data Flow
  42. 42. Data Flow Mutation.setFollowing(true)
  43. 43. Data Flow Mutation.setFollowing(true)
  44. 44. Data Flow isFollowing = true
  45. 45. Data Flow 

  46. 46. Data Flow
  47. 47. letswift(17) Example - Live Coding
  48. 48. Community Swift Korea Slack: #reactorkit • http://slack.swiftkorea.org/ RxSwift Slack: #reactorkit ( ) • http://rxswift-slack.herokuapp.com/
  49. 49. http://reactorkit.io

×