Bring back the `from` parameter in SharedViewModel property delegate
See original GitHub issueIs your feature request related to a problem? Please describe. In the newest version of Koin: 2.1.3 I cannot easily make a custom scope for my ViewModel.
Describe the solution you’d like
In version 2.0.1 of Koin, which I am using right now, there is a parameter from
in SharedViewModel property delegate. In the newest version, 2.1.3 this parameter is gone.
Describe alternatives you’ve considered
As discussed in this topic: #442, the current solution is:
val owner = requireParentFragment().requireParentFragment().findNavController().getViewModelStoreOwner(navGraphId)
But is is not elegant. I liked the from
parameter much more.
Target Koin project Do not know. 😃
Issue Analytics
- State:
- Created 3 years ago
- Reactions:11
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Shared ViewModel Across Fragments - Android Developers
You will learn how to use a shared ViewModel to share data between the fragments of the same activity and new concepts like...
Read more >Advanced ViewModels (part III): Sharing data between ...
Per documentation, by activityViewModels is a property delegate to get a reference to the ViewModel scoped to its Activity. So, our shared ViewModel...
Read more >Get the same instance of ViewModel in Fragment which is ...
Using KOIN. ViewModel instance can be shared between Fragments and their host Activity. To inject a shared ViewModel in a Fragment use:
Read more >Android ViewModel & Navigation | Koin
To inject a shared ViewModel in a Fragment use: by activityViewModel() - lazy delegate property to inject shared ViewModel instance into a property...
Read more >Shared ViewModel - Explained | Android Studio Tutorial
My Online Courses ⭐Discount Coupon: LAUNCH-STEVDZA-SANhttps://stevdza-san.com Wanna become a member?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This param is
owner
notfrom
👍for those who didn’t find answer owner param without findNavController()
I currently facing one parent fragment and three child fragment, and the solution is
BE CAUTION: I call requireParentFragment twice because i use fragmentContainerView in parent fragment. depend on your project, you might need to change to once or whatever situation you facing.