Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add viewmodel get key to koin, and add KoinViewModelLazy class #1373

Closed
wants to merge 1 commit into from

Conversation

allen-hsu
Copy link

Hi, because the ViewModel provider has the function (ViewModelProvider.get(key, clazz)) that can let you pass the key to ViewModel provide in order to get a different ViewModel with a different key, I want to raise this PR, and according to this :
#213

Originally I was going to change ViewModelProvider.resolveInstance, but I found that the new version of koin uses ViewModelLazy instead, but it is an Android lib, so I tried to build a KoinViewModelLazy, please consider this scenario carefully, I believe that I am not the only one who needs to pass in the key

@allen-hsu allen-hsu changed the title Add viewmodel get key to koin, add add KoinViewModelLazy class Add viewmodel get key to koin, and add KoinViewModelLazy class Jun 29, 2022
@arnaudgiuliani arnaudgiuliani added android type:improvement Improving a current feature labels Aug 29, 2022
@arnaudgiuliani arnaudgiuliani added this to the 3.3.0 milestone Aug 29, 2022
@arnaudgiuliani arnaudgiuliani added the status:checking currently in analysis - discussion or need more detailed specs label Aug 29, 2022
@arnaudgiuliani arnaudgiuliani modified the milestones: 3.3.0, android-3.3.0 Oct 24, 2022
@arnaudgiuliani
Copy link
Member

The VIewModel API has been revamped with latest lifecycle library in 2.5.1. Key property can be accessed in generic API.
#1459

Thanks for your proposal. Don't hesitate to give feedback on koin-android 3.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android:viewmodel android status:checking currently in analysis - discussion or need more detailed specs type:improvement Improving a current feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants