Интересные размышления на тему: "В какой момент дергать UseCase (или репозиторий) в ViewModel". Автор предлагает несколько решений и описывает плюсы и минусы.
#android #mvvm #viewmodel
https://proandroiddev.com/when-to-load-data-in-viewmodels-ad9616940da7
#android #mvvm #viewmodel
https://proandroiddev.com/when-to-load-data-in-viewmodels-ad9616940da7
Medium
When to load data in ViewModels
Recently I had a surprisingly long discussion on an ostensibly easy question. Where in our code should we actually trigger the loading of…
Статья о том как под капотом реализовано сохранение ViewModel живым при повороте экрана.
#android #viewmodel
https://blog.mindorks.com/android-viewmodels-under-the-hood
#android #viewmodel
https://blog.mindorks.com/android-viewmodels-under-the-hood
Mindorks
Android ViewModels: Under the hood
In this article, we are going to discuss the internals of ViewModel which is a part of Android Architecture Components. We will first briefly discuss the usages of ViewModel in Android and then we will go in detail about how ViewModel actually works and…
Подробный разбор механизма "живучести" ViewModel
#android #jetpack #viewmodel
https://bowser-f.medium.com/how-viewmodel-works-under-the-hood-52a4f1ff64cf
#android #jetpack #viewmodel
https://bowser-f.medium.com/how-viewmodel-works-under-the-hood-52a4f1ff64cf
Medium
How ViewModel works under the hood
Learn how a ViewModel survives to a configuration change
Краткий обзор фабрик, которые дают нам возможность повлиять на создание основных Android сущностей
- AppComponentFactory for customising the instantiation of application components
- LayoutInflater.Factory2 and View for customising view inflation
- FragmentFactory for customising fragment creation
- ViewModelProvider.Factory with CreationExtras for simplifying ViewModel creation
- WorkerFactory for customising Worker creation in WorkManager
#android #activity #fragment #viewmodel #di
https://marcellogalhardo.dev/posts/injection-points/
- AppComponentFactory for customising the instantiation of application components
- LayoutInflater.Factory2 and View for customising view inflation
- FragmentFactory for customising fragment creation
- ViewModelProvider.Factory with CreationExtras for simplifying ViewModel creation
- WorkerFactory for customising Worker creation in WorkManager
#android #activity #fragment #viewmodel #di
https://marcellogalhardo.dev/posts/injection-points/
В Hilt появилась возможность использовать Assisted Injection для ViewModel, чтобы передавать свои объекты в конструктор модели.
#android #dagger #hilt #viewmodel
https://medium.com/@alexander.michaud/hiltviewmodel-assisted-injection-with-compose-a800723165bf
#android #dagger #hilt #viewmodel
https://medium.com/@alexander.michaud/hiltviewmodel-assisted-injection-with-compose-a800723165bf
Статья о технической реализации UI событий в ViewModel
#android #viewmodel #architecture #event
https://proandroiddev.com/viewmodel-events-as-state-are-an-antipattern-35ff4fbc6fb6 (Оригинал)
https://shorturl.at/dghip (Перевод)
#android #viewmodel #architecture #event
https://proandroiddev.com/viewmodel-events-as-state-are-an-antipattern-35ff4fbc6fb6 (Оригинал)
https://shorturl.at/dghip (Перевод)
Medium
ViewModel: Events as State are an Antipattern
In this article Nikita explores how a popular notion about expressing events as states may be a misleading one.
В третьей части серии статей о ViewModel Best Practices обсуждают следующие пункты:
- Try not to import Android dependencies in the ViewModels:
- Lazily inject dependencies in the constructor.
#android #viewmodel
https://proandroiddev.com/mastering-android-viewmodels-essential-dos-and-donts-part-3-%EF%B8%8F3%EF%B8%8F%E2%83%A3-1833ce3ddd2b
- Try not to import Android dependencies in the ViewModels:
- Lazily inject dependencies in the constructor.
#android #viewmodel
https://proandroiddev.com/mastering-android-viewmodels-essential-dos-and-donts-part-3-%EF%B8%8F3%EF%B8%8F%E2%83%A3-1833ce3ddd2b