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
120
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
[PyCon Korea 2024 Keynote] 커뮤니티와 파이썬, 그리고 우리
beomi
0
120
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
170
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
160
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
390
Click-free releases & the making of a CLI app
oheyadam
2
100
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
160
ヤプリ新卒SREの オンボーディング
masaki12
0
110
Quine, Polyglot, 良いコード
qnighy
4
620
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
170
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
480
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
300
受け取る人から提供する人になるということ
little_rubyist
0
180
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
520
39k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
700
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Raft: Consensus for Rubyists
vanstee
136
6.6k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
15
2k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Automating Front-end Workflow
addyosmani
1366
200k
A Modern Web Designer's Workflow
chriscoyier
693
190k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Building Your Own Lightsaber
phodgson
102
6.1k
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