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
入力を型で表現する
Search
Motoki Narita
October 25, 2017
Technology
4k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
入力を型で表現する
https://potatotips.connpass.com/event/68024/
での発表内容です
Motoki Narita
October 25, 2017
More Decks by Motoki Narita
See All by Motoki Narita
Mercari 10years iOS Development
motokiee
5
4.8k
Alexa, Swiftで スマートスピーカーは実装できる?
motokiee
0
2k
iOSの自動化と仕組み化 ~コードと設計に集中する~
motokiee
11
3.1k
Move Fast iOS Development
motokiee
4
4k
結婚式を支えた技術 Firebaseを活用したサーバレスiOSアプリケーション開発
motokiee
33
26k
Vision Framework 入門
motokiee
2
2k
Lightweight Dependency Injection tips
motokiee
10
3.3k
Hello React Native
motokiee
8
640
RxSwift in Practice
motokiee
11
6.1k
Other Decks in Technology
See All in Technology
クラウド上のデータ復旧で見落としがちな制約: 医療系 SaaS の BCP 設計から得た教訓
kakehashi
PRO
0
810
SRE Lounge Hiroshimaへの招待
grimoh
0
310
NDIAS CTF 2026 問題解説会資料
bata_24
0
180
アカウントが増えてからでは遅い? ~ マルチアカウント統制の勘所 ~
kenichinakamura
0
150
グローバルチームと挑むプロダクト開発
sansantech
PRO
1
160
知らん間に、回ってる
ming_ayami
0
220
知見・人・API・DB・予算 ─ ナイナイ尽くしだった人事データ整備 with dbt、5年間の学び
ken6377
1
160
Oracle Exadata Database Service on Cloud@Customer X11M (ExaDB-C@C) サービス概要
oracle4engineer
PRO
2
8.3k
人を動かすのは時間ではなく、納得感 〜新任EMが入社3ヶ月、組織を2回変えた話〜
kakehashi
PRO
2
110
AIに障害切り分けを全部やってもらった。 。 。 。
estie
0
370
AIに「使われる」時代のSaaS戦略 〜既存WebAPIのMCPサーバー化における開発ノウハウ〜
ekispert_api
0
300
ローカルLLMとLINE Botの組み合わせ その3 / LINE DC Generative AI Meetup #8
you
PRO
0
110
Featured
See All Featured
Music & Morning Musume
bryan
47
7.3k
エンジニアに許された特別な時間の終わり
watany
107
250k
Everyday Curiosity
cassininazir
0
250
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
440
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1k
How GitHub (no longer) Works
holman
316
150k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.2k
Raft: Consensus for Rubyists
vanstee
141
7.6k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.3k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
380
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
Transcript
ೖྗΛܕͰදݱ͢Δ !NPUPLJFF QPUBUPUJQT
ࣗݾհ w HJUIVC UXJUUFS!NPUPLJFF w ϝϧΧϦικJ04ΤϯδχΞ w ϝϧΧϦΧϧνʔϜ w J04%$+BQBOελοϑ
None
ʙອըηοτͷग़ɾߪೖʹରԠ
ग़ํ๏ όʔίʔυΛಡΈࠐΉ ˠ&"/ίʔυ͔Β"1*ܦ༝ͰใΛऔಘ λΠτϧ͔Βݕࡧ͢Δ ˠςΩετ͔ΒใΛऔಘʢ6*্ɺσʔλऔಘࡁʣ
%FNP
ग़ը໘ͦͦ͜͜ෳࡶ w ܦ࿏͕ෳʢ͍·͚ͭͩͲʜʣ w όʔίʔυಡΈࠐΈ w λΠτϧݕࡧ w ϓϨʔεϗϧμͷදࣔ w
్தͰͷใ͕ΓସΘΔʢອըηοτʣ
ෳͷೖྗΛͭͷܕͰදݱ
struct ProactiveExhibit { enum Input: Equatable { case ean(String) case
exhibit(BulkIncludeExhibit) } let input: Input } ೖྗͷநԽ
struct ProactiveExhibit { enum Input: Equatable { case ean(String) case
exhibit(BulkIncludeExhibit) } let input: Input } Χϝϥ͔ΒऔಘͰ͖Δ&"/ίʔυ ʢใऔಘΛ"1*ܦ༝Ͱऔಘʣ
struct ProactiveExhibit { enum Input: Equatable { case ean(String) case
exhibit(BulkIncludeExhibit) } let input: Input } λΠτϧݕࡧը໘͔Β͞ΕΔใ ʢݕࡧࡁΈͷใ͕ͦͷ··͞ΕΔʣ
let input = Observable .of(scanCamera.barcodeNumber.map { ProactiveExhibit.Input.ean($0) }, exhibitAdapter.map {
ProactiveExhibit.Input.exhibit(BulkIncludeExhibit(exhibits: [$0])) } ) .merge() .asDriver(onErrorDriveWith: .empty()) let removeExhibitsInput = Observable .merge(GlobalObservable.removeExhibitsForExhibitCamera, removeExhibitAdapter) .asDriver(onErrorDriveWith: .empty()) let replaceExhibitInput = replaceExhibitAdapter.asDriver(onErrorDriveWith: .empty()) viewModel = ExhibitCameraViewModel(input: input, removeExhibitsInput: removeExhibitsInput, replaceExhibitInput: replaceExhibitInput) Χϝϥ͔Βͬͯ͘Δ&"/ίʔυͷετϦʔϜͱɺ λΠτϧը໘͔Β͞ΕΔσʔλͷετϦʔϜΛNFSHF ˠ%SJWFS1SPBDUJWF&YIJCJU*OQVU
let input = Observable .of(scanCamera.barcodeNumber.map { ProactiveExhibit.Input.ean($0) }, exhibitAdapter.map {
ProactiveExhibit.Input.exhibit(BulkIncludeExhibit(exhibits: [$0])) } ) .merge() .asDriver(onErrorDriveWith: .empty()) let removeExhibitsInput = Observable .merge(GlobalObservable.removeExhibitsForExhibitCamera, removeExhibitAdapter) .asDriver(onErrorDriveWith: .empty()) let replaceExhibitInput = replaceExhibitAdapter.asDriver(onErrorDriveWith: .empty()) viewModel = ExhibitCameraViewModel(input: input, removeExhibitsInput: removeExhibitsInput, replaceExhibitInput: replaceExhibitInput) Χϝϥ͔Βͬͯ͘Δ&"/ίʔυͷετϦʔϜ
let input = Observable .of(scanCamera.barcodeNumber.map { ProactiveExhibit.Input.ean($0) }, exhibitAdapter.map {
ProactiveExhibit.Input.exhibit(BulkIncludeExhibit(exhibits: [$0])) } ) .merge() .asDriver(onErrorDriveWith: .empty()) let removeExhibitsInput = Observable .merge(GlobalObservable.removeExhibitsForExhibitCamera, removeExhibitAdapter) .asDriver(onErrorDriveWith: .empty()) let replaceExhibitInput = replaceExhibitAdapter.asDriver(onErrorDriveWith: .empty()) viewModel = ExhibitCameraViewModel(input: input, removeExhibitsInput: removeExhibitsInput, replaceExhibitInput: replaceExhibitInput) λΠτϧը໘͔Β͞ΕΔσʔλͷετϦʔϜ
let input = Observable .of(scanCamera.barcodeNumber.map { ProactiveExhibit.Input.ean($0) }, exhibitAdapter.map {
ProactiveExhibit.Input.exhibit(BulkIncludeExhibit(exhibits: [$0])) } ) .merge() .asDriver(onErrorDriveWith: .empty()) let removeExhibitsInput = Observable .merge(GlobalObservable.removeExhibitsForExhibitCamera, removeExhibitAdapter) .asDriver(onErrorDriveWith: .empty()) let replaceExhibitInput = replaceExhibitAdapter.asDriver(onErrorDriveWith: .empty()) viewModel = ExhibitCameraViewModel(input: input, removeExhibitsInput: removeExhibitsInput, replaceExhibitInput: replaceExhibitInput) ೖྗΛ7JFX.PEFMͷॳظԽ࣌ʹ͢
1SPBDUJWF&YIJCJU*OQVUͰ දࣔॲཧ"1*ϦΫΤετॲཧΛ͚Δ
let fetchProgress = filteredInput .flatMap { [weak self] input ->
Driver<Progress<(ProactiveExhibit.Input, [Exhibit])>> in switch input { case .ean(let ean): let request = ExhibitAPI.FindByEAN(ean: ean) let response = APIClient.shared.response(request) .map { response -> (ProactiveExhibit.Input, [Exhibit]) in return (input, response.elements) } return Progress.makeDriver(response) case .exhibit(let exhibit): return Driver.empty() } } *OQVUFBOͷ߹ͷΈϦΫΤετ
class ExhibitScannedDisplayViewCell: UICollectionViewCell { // লུ var proactiveExhibit: ProactiveExhibit? {
didSet { if let bulkIncludeExhibit = proactiveExhibit?.bulkIncludeExhibit { // ใදࣔ } else { // ϓϨʔεϗϧμදࣔ } } } } "1*ϦΫΤετ͕ඞཁͳ߹ʢFBOʣ ϓϨʔεϗϧμΛදࣔ͢ΔΑ͏$FMMͰදࣔॲཧ
class ExhibitScannedDisplayViewCell: UICollectionViewCell { // লུ var proactiveExhibit: ProactiveExhibit? {
didSet { if let bulkIncludeExhibit = proactiveExhibit?.bulkIncludeExhibit { // ใදࣔ } else { // ϓϨʔεϗϧμදࣔ } } } } ೖྗʹܕΛఆٛ͢Δ͜ͱͰσʔλͦͷͷͱ ผͰॲཧ͕Ͱ͖ΔΑ͏ʹͳΔ
ෳͷೖྗΛͭͷܕͰදݱ w σʔλ͚ͩͰͳ͘ೖྗʹܕΛ w σʔλࣗମͷॲཧͱը໘ͷॲཧΛ͍͢͠ w ೖྗ༰ʹΑͬͯॲཧ͕ҟͳΔΑ͏ͳ߹ʹ༗ޮ w ࠓޙɺೖྗͷόϦΤʔγϣϯ͕૿͑ΔΑ͏ͳ͜ͱ͕͋ͬ ͯಉ͡ܕͰදݱ͢Δ͜ͱ͕Ͱ͖Δ
w όϦΤʔγϣϯ͕૿͑ͨࡍίϯύΠϧΤϥʔ͕ग़Δͷ ͰɺҰͭҰͭରԠ͍͚ͯ͠ྑ͍
͓ΘΓ