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
Oracle AI Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
6
1.5k
Claude Code の Sandbox 機能を Anthropic Sandbox Runtime(srt) で試そう!/lets-play-anthropic-sandbox-runtime
tomoki10
1
580
人材育成分科会.pdf
_awache
4
230
フィジカル版Github Onshapeの紹介
shiba_8ro
0
120
ルールやカスタム機能、どう活かす?ハンズオンで体感するIBM Bobの出力コントロール
muehara
1
150
AI駆動開発を通して感じた、 AI時代のデザイナーの役割変化
whisaiyo
3
2.1k
2026.06.13_AI時代に事業会社が「SIer出身エンジニア」を求める理由 / Why Businesses Seek Engineers with a System Integrator Background in the AI Era
jumtech
0
1.1k
SONiCの統計情報を取得したい
sonic
0
140
小さくはじめるSLI/SLO ~育てながら組織に定着させる実践知~ / Starting Small with SLI/SLOs: Building Adoption Through Continuous Growth
nari_ex
7
1.9k
NAB Show 2026 動画技術関連レポート / NAB Show 2026 Report
cyberagentdevelopers
PRO
0
200
2026TECHFRESH畢業分享會 - Lightning Talk - 打造精準高效的 MCP 設計模式與測試實務
line_developers_tw
PRO
0
970
20260619 私の日常業務での生成 AI 活用
masaruogura
1
200
Featured
See All Featured
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
71
40k
Bash Introduction
62gerente
615
220k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
230
Utilizing Notion as your number one productivity tool
mfonobong
4
320
The Curious Case for Waylosing
cassininazir
1
390
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
410
Paper Plane
katiecoart
PRO
1
51k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
Optimising Largest Contentful Paint
csswizardry
37
3.7k
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 όϦΤʔγϣϯ͕૿͑ͨࡍίϯύΠϧΤϥʔ͕ग़Δͷ ͰɺҰͭҰͭରԠ͍͚ͯ͠ྑ͍
͓ΘΓ