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
Spring gRPC について / About Spring gRPC
mackey0225
0
220
Introduction to kotlinx.rpc
arawn
0
670
最近のVS Codeで気になるニュース 2025/01
74th
1
260
ソフトウェアエンジニアの成長
masuda220
PRO
10
920
ペアーズでの、Langfuseを中心とした評価ドリブンなリリースサイクルのご紹介
fukubaka0825
2
310
一休.com のログイン体験を支える技術 〜Web Components x Vue.js 活用事例と最適化について〜
atsumim
0
320
自分ひとりから始められる生産性向上の取り組み #でぃーぷらすオオサカ
irof
8
2.7k
AWS Lambda functions with C# 用の Dev Container Template を作ってみた件
mappie_kochi
0
240
iOSエンジニアから始める visionOS アプリ開発
nao_randd
3
130
密集、ドキュメントのコロケーション with AWS Lambda
satoshi256kbyte
0
190
『GO』アプリ データ基盤のログ収集システムコスト削減
mot_techtalk
0
120
Honoをフロントエンドで使う 3つのやり方
yusukebe
7
3.1k
Featured
See All Featured
Music & Morning Musume
bryan
46
6.3k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
1k
A Modern Web Designer's Workflow
chriscoyier
693
190k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
31
2.1k
Bash Introduction
62gerente
610
210k
Mobile First: as difficult as doing things right
swwweet
223
9.3k
Rebuilding a faster, lazier Slack
samanthasiow
80
8.8k
A better future with KSS
kneath
238
17k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3k
Building Applications with DynamoDB
mza
93
6.2k
Agile that works and the tools we love
rasmusluckow
328
21k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
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