Last active
February 7, 2021 20:36
-
-
Save mlykotom/62f6e363d9d35980a666920fd677018e to your computer and use it in GitHub Desktop.
Connecting The Dots :: Assisted Saved State - ViewModel body
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SomeViewModel @AssistedInject constructor( | |
private val application: Application, | |
@Assisted private val savedStateHandle: SavedStateHandle | |
){ | |
// must be inside of the ViewModel class! | |
@AssistedFactory | |
interface Factory : AssistedSavedStateViewModelFactory<SomeViewModel> { | |
override fun create(savedStateHandle: SavedStateHandle): SomeViewModel // may be ommited prior kotlin 1.3.60 or after PR #121 in AssistedInject lib | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment