Chris Fillmore
10/07/2020, 2:11 AMandroidx.activity function viewModels() and pass dependencies to e.g. MyViewModel?allan.conda
10/07/2020, 6:04 AMChris Fillmore
10/07/2020, 11:53 PMby viewModels() lazy instantiation in activity-ktx artifact, see: https://developer.android.com/topic/libraries/architecture/viewmodel-savedstateallan.conda
10/07/2020, 11:54 PMallan.conda
10/07/2020, 11:54 PMviewModels() directly. You can also inject SavedStateHandle with @Assistedallan.conda
10/07/2020, 11:58 PMclass MainViewModel
@ViewModelInject
constructor(
private val repository: Repository,
@Assisted private val savedStateHandle: SavedStateHandle
): ViewModel()Chris Fillmore
10/07/2020, 11:58 PMChris Fillmore
10/07/2020, 11:58 PMChris Fillmore
10/07/2020, 11:59 PMallan.conda
10/07/2020, 11:59 PMallan.conda
10/07/2020, 11:59 PMChris Fillmore
10/07/2020, 11:59 PM