Aaron Pradhan
12/10/2021, 7:24 PMby sharedViewModel()
(which is shared with the parent activity, not parent fragment) and by viewModel()
(which I believe creates a new ViewModel instance for the child class). I'm using by viewModels({ requireParentFragment() })
right now, which works fine, but it's not using Koin. I looked at this article, which suggested by viewModel(owner = { ViewModelOwner.Companion.from(requireParentFragment().viewModelStore) })
, but that doesn't work anymore. Similarly, this article suggested by sharedViewModel(from = { requireParentFragment() })
, but the from
keyword doesn't exist anymore.Matt Thompson
12/10/2021, 8:25 PMsharedViewModel(owner = {
ViewModelOwner.from(requireParentFragment())
})
might work?Aaron Pradhan
12/11/2021, 7:31 PM