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
migrating-from-promise-to-reactive
Search
horimislime
March 23, 2017
Technology
0
350
migrating-from-promise-to-reactive
Gotanda.mobile #2 in VASILY (
https://gotandamb.connpass.com/event/50876/
)
horimislime
March 23, 2017
Tweet
Share
More Decks by horimislime
See All by horimislime
How we build our app with minimum 3rd party dependencies
horimislime
0
63
サポート効率を上げるためのロギング環境構築
horimislime
7
3.6k
社内Swiftもくもく会成果発表
horimislime
0
110
Swift Optional Extension Tips
horimislime
1
1.2k
ios-internationalization
horimislime
2
8.7k
UI testing in XCode7
horimislime
3
700
UIテストをカジュアルに自動化 / UI Automation using Remote
horimislime
2
2.2k
Swift Libraryざっくり現状確認 / Swift library overview
horimislime
1
120
1時間で作るSwiftアプリ / Swift Application in an hour
horimislime
2
110
Other Decks in Technology
See All in Technology
実録_マルチテナント環境でのGmailガイドライン対応
ryuichi1208
7
1.5k
Automate your changelogs! Release Drafter
onenashev
PRO
2
410
調整さんの調整結果をカレンダーへ登録するGPTsを作った話
hrsano645
1
160
人工衛星管制システムにおけるCICD / CICD in satellite control systems
iselegant
5
890
【OpenAI本出版記念】npakaによるOpenAI最新技術情報と技術情報キャッチアップ術
npaka
8
1.4k
SecurityCamp2023基板作るコース講義資料/Security Camp 2023 Lecture Materials
tnishinaga
5
1.3k
進化する事業とデータ構造 ~Cloudbaseの場合~
tockn
2
230
Proposal for a fictitious company presented by JAWS-UG DE&I team 'Naniwa Musume'
hiroramos4
PRO
0
120
Microsoft Fabric 開発ガイド
ryomaru0825
6
2.6k
Server-Side Kotlin + Spring Boot + Exposedでやったこと
ikefukurou777
0
110
スクラムマスター不在でスクラムをやるのは(とても辛いので)やめておけ! #scrumfukuoka
nulabinc
PRO
4
900
スケジュール指定のFargate Spotと友達になれた話
news_it_enj
0
240
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
43
9.6k
Atom: Resistance is Futile
akmur
258
25k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
111
35k
It's Worth the Effort
3n
180
27k
YesSQL, Process and Tooling at Scale
rocio
160
13k
10 Git Anti Patterns You Should be Aware of
lemiorhan
644
57k
[RailsConf 2023] Rails as a piece of cake
palkan
21
3.8k
How to name files
jennybc
62
91k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
11
1.4k
What the flash - Photography Introduction
edds
64
11k
Building Applications with DynamoDB
mza
88
5.5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
0
3.2k
Transcript
Promise͔ΒReactiveͷҠߦΛࡧ͢Δ Gotanda.mobile #2 @horimislime 1
self • @horimislime • גࣜձࣾτϨλ @ޒాTOC • ҿ৯ళ͚iPadாΞϓϦΛ։ൃͯ͠·͢ 2
͓ • PromiseͰඇಉظϓϩάϥϛϯά͍ͯ͠Δ/͠Α͏ͱ͍ͯ͠Δਓ ʹReactiveΛΦεεϝ͢Δ • ࣾͷΞϓϦͰͷࣄྫΛఴ͑ͯ 3
Objective-Cࢿ࢈ͷ͋ΔΞϓϦ • BoltsFrameworkʹΑΔPromise • APIClient͕BoltsͷTaskΛฦ͢ • ্ҐͰൣғʹBoltsʹґଘ 4
ͦͯ͠SwiftҠߦظ • BoltsAnyObject͕ฦ͖ͬͯͯπϥ͍ • SwiftyͳPromiseͷඞཁੑ • ͦͷޙ৭ʑ͋ͬͯҎԼʹґଘ͍ͯ͠Δ • Bolts-Objc •
SwiftTask • Bolts-Swift 5
PromiseͰͷ՝ײ • ଟ͘ͷͷͰErrorͷܕࢦఆ͕Ͱ͖ͳ͍ࣄͷෆຬ • ϝϯςφϯε͕׆ൃͰͳ͍ͷ͕ग़͖ͯͭͭ͋Δ 6
enum AppError: Error { case offline case network } get(userId:
1234).then { user in ... }.catch { error in // ! switch error as! AppError { ... } } 7
ɹɹɹ ݁Ռͷܕࢦఆ Errorͷܕࢦఆ Swift3 Bolts-Swift ✅ ❌ ✅ PromiseKit ✅
❌ ✅ SwiftTask ✅ ✅ ❌(branch༗) 8
Reactiveͷػӡ • SwiftҠߦͱڞʹSwiftBondΛ͍࢝Ίͯͨ • ReactiveKitͱ͍͏ମʹґଘ • PromiseͰΓ͍ͨࣄେମͰ͖Δ 9
Promise෩ຯͳReactiveKit findPrinter() .flatMapLatesst { printer in return send(document, to: printer)
}.flatMapLatest { result in return process(result) }.observe { event in switch event { case .completed: Progress.dismiss() case .failed(let error): switch error { case .network: Progress.showError("Network error!") ... } } } 10
ϝϦοτ • ͦΜͳʹҧײͳ͍͠ɺbinding͚ͩͰͳ͘ඇಉظॲཧָ͕ • طʹView bindingΛ͍ͬͯΕੑ˕ • ظతͳϝϯςφϯεͷظ 11
ಋೖͷোน • Reactiveͷֶशίετͷݒ೦ • ͜ͷ1͘Β͍ͰσϑΝΫτԽͨ͠ײ͕͋Δ • View Bindingʹ͏ͳΒશମతʹReactiveԽͨ͠ํ͕߹ ͕ྑ͍͜ͱଟ͍ 12
ߟ͓͖͑ͯ͘ࣄ • Promise / Rxؔ࿈ෳϨΠϠͰ༻͕ͪ͠ • Լखʹબ͢ΔͱେͳҠߦίετͰࢮ͵ • ࠷কདྷੑΛߟྀ͢Δ͖ॴ 13
·ͱΊ • SwiftΛऔΓר͘Promiseࣄ • ReactiveͷোนݮͬͯΔ͠ಋೖͷνϟϯε ! • ٕͨͩ͠ज़બఆ৻ॏʹ 14