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
ループエンジニアリングでE2Eテストを実践
noriyukitakei
0
290
スタートアップにおけるアジャイルの実践について #shibuyagile
murabayashi
3
2.1k
そのハーネス、本当に境界になっていますか? AIエージェント時代の実行環境設計【MEGU-Meet #4】
cscengineer
PRO
0
110
從觀望到全公司落地:AI Agentic Coding 導入實戰 — 流程整合與安全治理
appleboy
1
1k
Kotlin 開発のツラミを爆破した話! / Explode the difficulty of Kotlin dev!
eller86
0
150
オブザーバビリティ、本当に活用できてる? 〜API連携×生成AIで成熟度を自動評価〜
dmmsre
0
460
ポストモーテム! DDoSからサイトは守れた。 でもビジネスは守れなかった。
bengo4com
0
130
フルAIで個人開発して学んだあれこれ / yuruai vol.1
isaoshimizu
0
180
CSに"SLO"は要らない、経営層に"99.9%"は伝わらない - SREを全社に"翻訳"する3原則
cscengineer
PRO
0
1.8k
プライバシー保護の理論と実践
lycorptech_jp
PRO
1
240
トークン最適化のためのユーザーストーリー分析 / User Story Analysis for Token Optimization
oomatomo
0
170
最近評価が難しくなった
maroon8021
0
240
Featured
See All Featured
Building Adaptive Systems
keathley
44
3.1k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
220
The agentic SEO stack - context over prompts
schlessera
0
840
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
760
Typedesign – Prime Four
hannesfritz
42
3.1k
Designing Experiences People Love
moore
143
24k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
880
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
KATA
mclloyd
PRO
35
15k
Faster Mobile Websites
deanohume
310
32k
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 όϦΤʔγϣϯ͕૿͑ͨࡍίϯύΠϧΤϥʔ͕ग़Δͷ ͰɺҰͭҰͭରԠ͍͚ͯ͠ྑ͍
͓ΘΓ