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
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
220
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
250
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
190
Prompt Engineering for Job Search
mfonobong
0
360
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
Un-Boring Meetings
codingconduct
0
330
Git: the NoSQL Database
bkeepers
PRO
432
67k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
230
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 使う人がわかりやすい事を念頭におく事が大事だと考えるので、このよう
な考え方は良いと考え、この場をお借りして、発言させていただきました。 皆様のご意見、ご感想をいただけますと非常に幸いでございます。 以上となります。
ご静聴いただき誠にありがとうございました。 🎉