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
Compose UIテストを使った統合テスト
hiroaki404
0
110
testcontainers のススメ
sgash708
1
130
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
820
ドメインイベント増えすぎ問題
h0r15h0
2
450
Kaigi on Railsに初参加したら、その日にLT登壇が決定した件について
tama50505
0
120
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
4
400
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
300
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
5
1k
nekko cloudにおけるProxmox VE利用事例
irumaru
3
470
オニオンアーキテクチャを使って、 Unityと.NETでコードを共有する
soi013
0
190
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
170
バグを見つけた?それAppleに直してもらおう!
uetyo
0
190
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
40
2.4k
Bash Introduction
62gerente
609
210k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
300
Testing 201, or: Great Expectations
jmmastey
41
7.1k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Designing Experiences People Love
moore
138
23k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
1
110
Site-Speed That Sticks
csswizardry
2
190
Why Our Code Smells
bkeepers
PRO
335
57k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.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