Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ReactorKit으로 단방향 반응형 앱 만들기
Search
Suyeol Jeon
September 24, 2017
Programming
0
130
ReactorKit으로 단방향 반응형 앱 만들기
https://www.slideshare.net/devxoul/reactorkit
Suyeol Jeon
September 24, 2017
Tweet
Share
More Decks by Suyeol Jeon
See All by Suyeol Jeon
성장하는 iOS 개발자 되기
devxoul
2
230
레거시 프로젝트에서 의존성 주입하기
devxoul
1
2.3k
Let's TDD
devxoul
0
70
Hello, ReactorKit 👋
devxoul
0
84
Build Funnels with Google BigQuery
devxoul
0
32
RxSwift 시작하기
devxoul
1
350
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
devxoul
10
3.2k
좋은 디자이너, 나쁜 프로젝트매니저, 이상한 개발자
devxoul
0
100
Other Decks in Programming
See All in Programming
Jakarta EE meets AI
ivargrimstad
0
680
ヤプリ新卒SREの オンボーディング
masaki12
0
130
初めてDefinitelyTypedにPRを出した話
syumai
0
430
Jakarta EE meets AI
ivargrimstad
0
740
Functional Event Sourcing using Sekiban
tomohisa
0
110
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
デザインパターンで理解するLLMエージェントの作り方 / How to develop an LLM agent using agentic design patterns
rkaga
4
450
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
200
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
2k
RubyLSPのマルチバイト文字対応
notfounds
0
120
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
250
Featured
See All Featured
Done Done
chrislema
181
16k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Making Projects Easy
brettharned
115
5.9k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Statistics for Hackers
jakevdp
796
220k
Designing the Hi-DPI Web
ddemaree
280
34k
How to Ace a Technical Interview
jacobian
276
23k
Code Review Best Practice
trishagee
64
17k
Being A Developer After 40
akosma
87
590k
A designer walks into a library…
pauljervisheath
204
24k
Visualization
eitanlees
145
15k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Transcript
let swift(17) ReactorKit ReactorKitਵ۽ ױߑೱ ߈ഋ জ ٜ݅ӝ github.com/devxoul ࣻৌ
ࣻৌ • StyleShare, Inc. • Open Source Lover • Then
• URLNavigator • RxSwift • ObjectMapper
let swift(17) Why?
Why? 1. Massive View Controller • ݆ ࢎۈٜ ҕхೞח
ޙઁ • ೧Ѿೞӝ ਤೠ ৈ۞ ࢸ҅ ಁఢٜ ઓ
Why? 1. Massive View Controller • ݆ ࢎۈٜ ҕхೞח
ޙઁ • ೧Ѿೞӝ ਤೠ ৈ۞ ࢸ҅ ಁఢٜ ઓ 2. RxSwift is Awesome • ࠺زӝ ٘ܳ рѾೞѱ ࢎਊೡ ࣻ • য۵݅ ੜ ॳݶ ҭ ਕಽೠ ӝࣿ
Why? ೞҊर Ѫ: 1. Massive View Controllerܳ ೖೞݶࢲ 2. RxSwift
ਸ ݽف ஂೞҊ र
Why? - Problems ਬݺೠ ࢸ҅ ಁఢী RxSwiftܳ ࠢৈࠅө? • Rx
+ MVC? • Rx + MVVM? ⚠ ҕాੋ ޙઁ: ࢚క ҙܻо ݒ য۵.
Why? - Problems Cyclic Data Dependencies • সਸ ਤ೧
স Ѿҗо ਃ • द: ইې۽ झ܀ೞৈ ಕ ۽٘ • ਃী ਃ Ѿҗ nextURL ਃ
Why? - Problems Cyclic Data Dependencies • औѱ ೧Ѿೞח ߑߨ:
BehaviorSubject ࢎਊ • BehaviorSubject(=Variable)ܳ թߊ • RxSwiftח ࢶਵ۽ ࢿೞח Ѫਸ ӂ
Why? ೞҊर Ѫ: 1. Massive View Controllerܳ ೖೞݶࢲ 2. RxSwift
ਸ ݽف ஂೞҊ र
Why? ೞҊर Ѫ: 1. Massive View Controllerܳ ೖೞݶࢲ 2. RxSwift
ਸ ݽف ஂೞҊ र 3. ӒܻҊ ࢚క ҙܻо एਛਵݶ જѷ
let swift(17) ReactorKit ױߑೱ ؘఠ ܴਸ о ߈ഋ জਸ ਤೠ
ۨਕ
ReactorKit 1. Massive View Controllerܳ ೖೞҊ र. ✅ • ࠭৬
۽ ҙबࢎ ܻ࠙ • ࠭ ஶ܀۞о ױࣽ೧
ReactorKit 2. RxSwift ਸ ݽف ஂೞҊ र. ✅ • ReactorKit
RxSwiftܳ ӝ߈ਵ۽ ೣ • ݽٚ RxSwift ӝמਸ ࢎਊ оמ
ReactorKit 3. ࢚క ҙܻо एਛਵݶ જѷ. ✅ • ױߑೱ ؘఠ
ܴ • р ࢚కܳ reduce() ೣࣻ۽ ҙܻ • ࢚క ҙܻо рѾ೧
ReactorKit ӒܻҊ... • ౠ ӝמী ࠗ࠙ ਊ оמ (ѱ द)
• పझܳ ਤೠ بҳܳ ਵ۽ ਗ • CocoaPods ӝળ ࢸ 8800ഥ / জ 280ѐ
ReactorKit ӒܻҊ... • ౠ ӝמী ࠗ࠙ ਊ оמ (ѱ द)
• పझܳ ਤೠ بҳܳ ਵ۽ ਗ • CocoaPods ӝળ ࢸ 8800ഥ / জ 280ѐ
Basic Concept
Basic Concept • ࢎਊ ੑ۱ਸ ߉ইࢲ Reactorী ׳ • Reactor۽ࠗఠ
߉ ࢚కܳ ۪؊݂ • ࠭ ஶ܀۞, ࣄ, ஶ܀ ١ਸ ݽف View۽ ஂә
Basic Concept protocol View { associatedtype Reactor var disposeBag: DisposeBag
// self.reactorо ߄Շݶ ഐؽ func bind(reactor: Reactor) }
Basic Concept protocol StoryboardView { associatedtype Reactor var disposeBag: DisposeBag
// ࠭о ۽٘غݶ ഐؽ func bind(reactor: Reactor) } // Storyboardܳ ࢎਊೞח ҃
Basic Concept • Viewীࢲ ׳߉ Actionী ٮۄ ۽ ࣻ೯ •
࢚కܳ ҙܻೞҊ ࢚కо ߸҃غݶ Viewী ׳ • ࠗ࠙ Viewח غח Reactorܳ о
Basic Concept protocol Reactor { associatedtype Action associatedtype Mutation associatedtype
State var initialState: State }
Basic Concept ୶࢚ചػ ࢎਊ ੑ۱ ୶࢚ചػ ࠭ ࢚క
Basic Concept ݽٚ ߄ੋ٬ RxSwift
Data Flow
Data Flow
Data Flow Action Stateܳ ߄۽ ߸҃ೞח ঋ • ࠺زӝ ఋী
Stateо ߸҃غח ҃о • Actionҗ State ࢎী Mutationਸ ىࢲ ࠺ز ӝ ܻ • Mutation Stateܳ ߸҃ೞח ݺ۸/স ױਤ • Mutation Viewী ֢غ ঋ
Data Flow
Data Flow class ProfileViewReactor: Reactor { enum Action { case
follow // ࢎਊ ੑ۱ } struct State { var isFollowing: Bool // ࠭ ࢚క } }
Data Flow class ProfileViewReactor: Reactor { enum Action { case
follow // ࢎਊ ੑ۱ } struct State { var isFollowing: Bool // ࠭ ࢚క } } ࢎਊܳ ౹۽ೞח API ਃ റ Stateо ߄Շযঠ ೣ
Data Flow class ProfileViewReactor: Reactor { enum Action { case
follow // ࢎਊ ੑ۱ } enum Mutation { case setFollowing(Bool) // ࢚క ߸҃ } struct State { var isFollowing: Bool // ࠭ ࢚క } }
Data Flow (Action) -> Observable<Mutation> (State, Mutation) -> State
Data Flow
Data Flow ౹۽ ߡౡ ఠ
Data Flow Action.follow
Data Flow Action.follow
Data Flow UserService.follow()
Data Flow UserService
Data Flow Observable<Bool>
Data Flow
Data Flow Mutation.setFollowing(true)
Data Flow Mutation.setFollowing(true)
Data Flow isFollowing = true
Data Flow ౹۽ ߡౡ সؘ
Data Flow
let swift(17) Example - Live Coding
Community Swift Korea Slack: #reactorkit օ • http://slack.swiftkorea.org/ RxSwift Slack:
#reactorkit օ (য) • http://rxswift-slack.herokuapp.com/
http://reactorkit.io