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
71
Hello, ReactorKit 👋
devxoul
0
85
Build Funnels with Google BigQuery
devxoul
0
33
RxSwift 시작하기
devxoul
1
350
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
devxoul
10
3.2k
좋은 디자이너, 나쁜 프로젝트매니저, 이상한 개발자
devxoul
0
100
Other Decks in Programming
See All in Programming
Writing documentation can be fun with plugin system
okuramasafumi
0
120
chibiccをCILに移植した結果 (NGK2025S版)
kekyo
PRO
0
210
How mixi2 Uses TiDB for SNS Scalability and Performance
kanmo
30
11k
ASP. NET CoreにおけるWebAPIの最新情報
tomokusaba
0
360
バックエンドのためのアプリ内課金入門 (サブスク編)
qnighy
8
1.7k
2024年のkintone API振り返りと2025年 / kintone API look back in 2024
tasshi
0
210
技術を根付かせる / How to make technology take root
kubode
1
240
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
170
CI改善もDatadogとともに
taumu
0
110
Software Architecture
hschwentner
6
2.1k
『品質』という言葉が嫌いな理由
korimu
0
160
CNCF Project の作者が考えている OSS の運営
utam0k
5
690
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
51
7.4k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
29
4.6k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.8k
Building an army of robots
kneath
302
45k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
20
2.4k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Build The Right Thing And Hit Your Dates
maggiecrowley
34
2.5k
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