Created
May 9, 2021 15:54
-
-
Save svinouze/8a834a7e9937d2671f451ae6283e29eb to your computer and use it in GitHub Desktop.
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
interface SavedStateViewModelFactory<T : ViewModel> { | |
fun create(savedStateHandle: SavedStateHandle): T | |
} | |
class MyViewModel @AssistedInject constructor( | |
private val repository: Repository, | |
@Assisted private val savedStateHandle: SavedStateHandle, | |
) : ViewModel() { | |
@AssistedFactory | |
interface Factory : SavedStateViewModelFactory<MyViewModel> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment