Is there a way to simplify this code? ``` overr...
# android
m
Is there a way to simplify this code?
Copy code
override fun initializeViewModel(): OnboardingViewModel {
        val model: OnboardingViewModel by viewModels { viewModelFactory }
        return model
    }
w
I didn’t tested, but isn’t possible to do
Copy code
override fun initializeViewModel(): OnboardingViewModel = viewModels<OnboardingViewModel> { vmFactory }.value
a
Why not just use a single expression?
m
Can you provide an example?
I'm trying to do just that but can't figure out the syntax
I think others in the main channel have suggested though