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.2k
NabigationControllerとの付き合い方
keisukeyamagishi
0
330
開発効率を考えてみました。xsort
keisukeyamagishi
0
330
Featured
See All Featured
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
240
Design in an AI World
tapps
1
260
How to Think Like a Performance Engineer
csswizardry
28
2.7k
sira's awesome portfolio website redesign presentation
elsirapls
0
290
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
Into the Great Unknown - MozCon
thekraken
41
2.6k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
310
GitHub's CSS Performance
jonrohan
1033
470k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
240
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
210
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
270
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 使う人がわかりやすい事を念頭におく事が大事だと考えるので、このよう
な考え方は良いと考え、この場をお借りして、発言させていただきました。 皆様のご意見、ご感想をいただけますと非常に幸いでございます。 以上となります。
ご静聴いただき誠にありがとうございました。 🎉