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.7k
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
不要なレビューをAIにまかせて AIコーディングの環境改善を加速した
shoota
1
230
2026 TECHFRESH 畢業分享會 - 開發日常大解密!從領域驅動到企業級上線
line_developers_tw
PRO
0
1.3k
SONiC Scale-Up Working Group から探る Scale-UpやUltraEthernet機能の実装方法
ebiken
PRO
2
410
自宅LLMの話
jacopen
1
650
AI-DLCを “そのまま導入しなかった”話 ~組織に合わせてアジャストした 私たちの実践共有~
hiroramos4
PRO
0
210
ACE-Step-1.5で見る 音楽生成AIのしくみと“破綻だけ直す”Retake機能の開発【zennfes spring 2026 登壇資料】
personabb
1
540
GitHub Copilot 最新アップデート – 「一歩先」の実践活用術
moulongzhang
5
1.5k
GitHub Copilot app最速の発信の裏側
tomokusaba
1
190
【NRUG vol.18】KubernetesにおけるNew Relicデータ取得量削減の考え方
nrug_member
0
170
SteampipeとExcel Power QueryでAWS構成定義書の作成を自動化する
jhashimoto
0
160
新しいUbuntu/GNOMEが使いたいからXからWaylandへ移行頑張ってるの巻 2026-06-20
nobutomurata
0
150
日本 Fintech 未来予測レポート 2027〜2028年(手動編集版)
8maki
1
2.5k
Featured
See All Featured
sira's awesome portfolio website redesign presentation
elsirapls
0
280
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Building Applications with DynamoDB
mza
96
7.1k
First, design no harm
axbom
PRO
2
1.2k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
How to Talk to Developers About Accessibility
jct
2
240
A Modern Web Designer's Workflow
chriscoyier
698
190k
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 όϦΤʔγϣϯ͕૿͑ͨࡍίϯύΠϧΤϥʔ͕ग़Δͷ ͰɺҰͭҰͭରԠ͍͚ͯ͠ྑ͍
͓ΘΓ