ViewModel

Code

Accessing screen arguments in ViewModels using SavedStateHandle

One of the common use cases I have noticed when using `HiltViewModel`’s(or normal `ViewModel`) is figuring out how to provide runtime screen arguments. Usually the ones you send as intent extras or fragment arguments. In this article let's take a look at how you can use `SavedStateHandle` to read screen arguments.

Read
Code

Using ViewModels in custom views

Let's take a look at how we can use `ViewModel`'s in custom views using `ViewTreeViewModelStoreOwner`

Read