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
2026TECHFRESH畢業分享會 - AI 時代的人生存檔點
line_developers_tw
PRO
0
1.3k
Bucharest Tech Week 2026 - Reinventing testing practices in the AI era
edeandrea
PRO
1
170
スタートアップにAmazon EKSは早すぎる? マルチプロダクト戦略を加速する Platform Engineeringの実践 / Is Amazon EKS Too Soon for Startups? Practical Platform Engineering to Accelerate a Multi-Product Strategy
elmodev09
0
370
2026年6月23日 Syncable Tech + Start Python Club にて
hamukazu
0
140
入門!AWS Blocks
ysuzuki
1
160
PostgreSQL 19 新機能概要 OSC Hokkaido 2026
nori_shinoda
0
140
自宅LLMの話
jacopen
1
650
コミュニティの有益性 ~JAWS Days 2026 での体験を通して~ / The Benefits of a Community ~Through My Experience at JAWS Days 2026~
seike460
PRO
0
180
SteampipeとExcel Power QueryでAWS構成定義書の作成を自動化する
jhashimoto
0
160
脱SaaS!FDEを支えるプロビジョニングと分離設計
knih
0
240
Android の公式 Skill / Android skills
yanzm
0
160
MUSUBI 田中裕一『AIと共に行う「しごとのリデザイン」- スモールバックオフィス編』AI Ops Lab #4
musubi
0
270
Featured
See All Featured
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
160
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
290
Discover your Explorer Soul
emna__ayadi
2
1.1k
So, you think you're a good person
axbom
PRO
2
2.1k
RailsConf 2023
tenderlove
30
1.5k
HDC tutorial
michielstock
2
720
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
71
40k
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 όϦΤʔγϣϯ͕૿͑ͨࡍίϯύΠϧΤϥʔ͕ग़Δͷ ͰɺҰͭҰͭରԠ͍͚ͯ͠ྑ͍
͓ΘΓ