Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
MVVMについて.pdf
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
keisukeYamagishi
November 28, 2021
510
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
MVVMについて.pdf
keisukeYamagishi
November 28, 2021
More Decks by keisukeYamagishi
See All by keisukeYamagishi
RxAlert 結構便利だと思います。
keisukeyamagishi
0
220
Chart実装が楽になりました。
keisukeyamagishi
0
1.2k
NabigationControllerとの付き合い方
keisukeyamagishi
0
340
開発効率を考えてみました。xsort
keisukeyamagishi
0
340
Featured
See All Featured
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
350
Color Theory Basics | Prateek | Gurzu
gurzu
1
460
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
The Pragmatic Product Professional
lauravandoore
37
7.4k
Fireside Chat
paigeccino
43
4k
Building Applications with DynamoDB
mza
96
7.2k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
600
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Building the Perfect Custom Keyboard
takai
2
870
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
How to make the Groovebox
asonas
2
2.4k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
360
Transcript
僭越ながら、 MVVM🤔 Input Output について考えてみました。 Shichimitoucarashi keisuke yamagishi
自己紹介 名前:山岸恵介 iOSエンジニア Github: https://github.com/keisukeYamagishi HP: https://sevens-api.herokuapp.com/
読みやすく、わかりやすく、管理しやすい コンセプトは
まずは ’Input’これは入力される値を渡すわけです が、工学的🧐 学術的🤔、そして抽象的🤩
わかりづらいと感じます🤓
受信🎉 わかりやすい気がします(主観ですが) なので、 ’Input’は Receive
`receive` で定義したサンプルコード protocol ViewModelReceive: AnyObject { func callApi(_ indexPath: IndexPath)
}
`Output` に関しても、工学的🧐、学術的 🤔、そして抽象的🎉
やっぱりこちらもわかりづらいと感じます😇
なので😇 例えばですが、 画面遷移を伴うものは、 `route` で定義 UIに変化を反映させる場合は、 `ui` で定義。
routeのサンプルコード protocol ViewModelRoute: AnyObject { func detail(_ result: @escaping (Data?,
String, HTTPURLResponse?, Error?) -> Void) func transition(_ callBack: @escaping () -> Void) }
uiのサンプルコード protocol ViewModelUI: AnyObject { func progress(_ handler: @escaping ((Float)
-> Void)) }
ViewController側の実装🦾 viewModel.route.detail { [unowned self] data, str, res, error in
self.detail(data: data, param: str, response: res, error: error) } viewModel.route.transition {[unowned self] in self.detailViewController(isDL: true) } viewModel.ui.progress { percentage in self.progressView.progress = percentage } viewModel.receive.callApi(indexPath)
まとめ この書き方については、「Nuke」の作者の「Alex Grebenyuk」のtweetをみて自分なりに作成してみまし た。 https://github.com/kean https://twitter.com/a_grebenyuk サンプルが下記になります。興味のある方はみていただけますと幸いです。 https://github.com/Jelly-and-removes/HttpSession/tree/feature/new-architectur e 使う人がわかりやすい事を念頭におく事が大事だと考えるので、このよう
な考え方は良いと考え、この場をお借りして、発言させていただきました。 皆様のご意見、ご感想をいただけますと非常に幸いでございます。 以上となります。
ご静聴いただき誠にありがとうございました。 🎉