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
MVVMについて.pdf
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
keisukeYamagishi
November 28, 2021
500
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
210
Chart実装が楽になりました。
keisukeyamagishi
0
1.1k
NabigationControllerとの付き合い方
keisukeyamagishi
0
330
開発効率を考えてみました。xsort
keisukeyamagishi
0
330
Featured
See All Featured
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
200
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
Test your architecture with Archunit
thirion
1
2.3k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
730
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
200
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
200
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
The untapped power of vector embeddings
frankvandijk
2
1.8k
Prompt Engineering for Job Search
mfonobong
0
340
A designer walks into a library…
pauljervisheath
211
24k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
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 使う人がわかりやすい事を念頭におく事が大事だと考えるので、このよう
な考え方は良いと考え、この場をお借りして、発言させていただきました。 皆様のご意見、ご感想をいただけますと非常に幸いでございます。 以上となります。
ご静聴いただき誠にありがとうございました。 🎉