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
Serialize process with screen transitions.
Search
417.72KI
February 28, 2019
Technology
2
1.3k
Serialize process with screen transitions.
potatotips #59
417.72KI
February 28, 2019
Tweet
Share
More Decks by 417.72KI
See All by 417.72KI
iTunes・おぼえていますか〜ScriptingBridge今昔物語〜
417_72ki
1
23
The history of entry-point in iOS app Development
417_72ki
0
360
R.swift to Asset Symbols
417_72ki
0
250
Refactor with using `available` and `deprecated`
417_72ki
3
600
CLIツールにSwift Concurrencyを適用させようとしている話
417_72ki
3
390
CI with Danger-Swift
417_72ki
1
200
Graduation from Playground beginner
417_72ki
3
890
Trap Questions in Java and Obj-C
417_72ki
1
270
ダックタイピングとidでUserDefaultsをモック化する
417_72ki
2
2.5k
Other Decks in Technology
See All in Technology
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
2
620
これまでの計測・開発・デプロイ方法全部見せます! / Findy ISUCON 2024-11-14
tohutohu
3
370
OS 標準のデザインシステムを超えて - より柔軟な Flutter テーマ管理 | FlutterKaigi 2024
ronnnnn
0
170
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
The Role of Developer Relations in AI Product Success.
giftojabu1
1
130
安心してください、日本語使えますよ―Ubuntu日本語Remix提供休止に寄せて― 2024-11-17
nobutomurata
1
1k
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
130
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
310
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
210
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
110
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
870
強いチームと開発生産性
onk
PRO
35
11k
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1366
200k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
890
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
How STYLIGHT went responsive
nonsquared
95
5.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Faster Mobile Websites
deanohume
305
30k
Speed Design
sergeychernyshev
25
620
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Docker and Python
trallard
40
3.1k
Transcript
ը໘ભҠ͕བྷΉͷड͚͠Λ 3Y4XJGUͰྻԽͯ͠Έͨ !QPUBUPUJQT
struct Me { let name = "Takuhiro Muta" let aka
= "417.72KI" let experienceYears = 5 let company = "iRidge inc." let twitter = "417_72ki" let qiita = "417_72ki" let gitHub = "417-72KI" let like = [ "BEMANI", "Real Escape Game", "Bang Dream!", "LoveLive! Sunshine!!", "etc…" ] } TFMGEFTDSJQUJPO
͢͜ͱ w ՝ͱΞϓϩʔνྫ
͞ͳ͍͜ͱ w 3Y4XJGUʹ͍ͭͯ w Έͱ͔ܕͱ͔ w ֤छΞʔΩςΫνϟʹͲ͏ద༻͢Δ͔
ී௨ͷෳࡶͳॲཧϑϩʔ "ͱ௨৴͢Δ "ͷ݁ՌΛͬͯ#ͱ௨৴͢Δ #ͷ݁ՌΛͬͯ$ͱ௨৴͢Δ
ී௨ͷෳࡶͳॲཧϑϩʔ func connectA() -> Single<String> func connectB(resultOfA: String) -> Single<String>
func connectC(resultOfB: String) -> Single<String> func doSomething() { connectA() .flatMap(connectB) .flatMap(connectC) .subscribe(onSuccess: { // ࠷ऴ݁ՌͰԿ͔͢Δ }, onError: { print($0) }) .disposed(by: disposeBag) }
None
ࠓճͷ՝ ྫ "ͱ௨৴͢Δ "ͷ݁ՌΛ8FC7JFXʹૹͬͯ Ϣʔβʔʹૢ࡞ͤ͞Δ Ϣʔβʔ͕ૢ࡞ͨ݁͠ՌΛ ϑοΫͯ͠$ͱ௨৴͢Δ 8FC7JFX$POUSPMMFS QSFTFOU7JFX$POUSPMMFS 8FC7JFX%FMFHBUF
EJTNJTT7JFX$POUSPMMFS 8FC7JFX$POUSPMMFS %FMFHBUF
ࠓճͷ՝ ྫ func doSomething() { connectA() .subscribe(onSuccess: { [unowned self]
in let webView = // initialize WebViewController webView.delegate = self webView.param = $0 self.present(webView, animated: true) }, onError: { print($0) }) .disposed(by: disposeBag) } // MARK: - WebViewControllerDelegate func webViewDidRespondSomething(_ value: String) { connectC(resultOfB: value) .subscribe(onSuccess: { // ࠷ऴ݁ՌͰԿ͔͢Δ print($0) }, onError: { print($0) }) .disposed(by: disposeBag) }
None
None
8FC7JFX$POUSPMMFSʹ 0CTFSWFSΛஔ͚ ྻԽͰ͖ΔͷͰʁ
None
ͬͨ͜ͱ w ݺͼग़͢7$ʹ0CTFSWFSΛஔ͘ w ݺͼग़͠ॲཧΛQSPUPDPMʹ͢Δ
ݺͼग़͢7$ʹ 0CTFSWFSΛஔ͘ class WebViewController: UIViewController { var param: String! private
let resultSubject = PublishSubject<String>() // ҎԼུ } extension WebViewController { var result: Maybe<String> { return resultSubject.asMaybe() } }
ݺͼग़͢7$ʹ 0CTFSWFSΛஔ͘ // MARK: - WKNavigationDelegate extension WebViewController: WKNavigationDelegate {
override func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { guard let result = doSomething(fromRequest: navigationAction.request) else { return } decisionHandler(.cancel) dismiss(animated: true) { [unowned self] in self.resultSubject.onNext(result) self.resultSubject.onCompleted() } }
ݺͼग़͠ॲཧΛ QSPUPDPMʹ͢Δ protocol WebViewOpenable { /// paramΛWebViewʹૹͬͯ݁ՌΛड͚औΔ func requestToWeb(withParam param:
String) -> Maybe<String> }
ݺͼग़͠ॲཧΛ QSPUPDPMʹ͢Δ extension WebViewOpenable where Self: UIViewController { func requestToWeb(withParam
param: String) -> Maybe<String> { guard let nav = R.storyboard.webView.instantiateInitialViewController(), let webView = nav.viewControllers.first as? WebView else { assertionFailure("Something wrong in WebView.storyboard") return Observable.error(CommonError.unknown) } webView.param = param defer { present(nav, animated: true) } return webView.result } }
ݩͷίʔυ func doSomething() { connectA() .subscribe(onSuccess: { [unowned self] in
let webView = // initialize WebViewController webView.delegate = self webView.param = $0 self.present(webView, animated: true) }, onError: { print($0) }) .disposed(by: disposeBag) } // MARK: - WebViewControllerDelegate func webViewDidRespondSomething(_ value: String) { connectC(resultOfB: value) .subscribe(onSuccess: { // ࠷ऴ݁ՌͰԿ͔͢Δ print($0) }, onError: { print($0) }) .disposed(by: disposeBag) }
ྻԽ͞Εͨίʔυ func doSomething() { connectA() .flatMap(requestToWeb) .flatMap(connectC) .subscribe(onSuccess: { //
࠷ऴ݁ՌͰԿ͔͢Δ print($0) }, onError: { print($0) }) .disposed(by: disposeBag) }
ྻԽ͞Εͨίʔυ func doSomething() { connectA() .flatMap { [unowned self] in
self.requestToWeb(withParam: $0) } .flatMap { [unowned self] in self.connectC(resultOfB: $0) } .bind(to: resultLabel.rx.text) .disposed(by: disposeBag) }
݁Ռ w ը໘ભҠ͕བྷΉΑ͏ͳॲཧϑϩʔભҠઌʹ 0CTFSWFSΛஔ͘͜ͱͰqBU.BQCJOEͰܨ͛Β ΕΔΑ͏ʹͳͬͨ w ॲཧதʹը໘ભҠ͕ൃੜ͢Δ͜ͱΛϑϩʔͷத Ͱҙࣝ͠ͳͯ͘ྑ͘ͳͬͨ w 1VCMJTI4VCKFDUJT༏ल
4BNQMF w IUUQTHJUIVCDPN,* 3Y4DSFFO5SBOTJUJPO4BNQMF
None