Skip to content

Instantly share code, notes, and snippets.

@orcchg
Created June 26, 2021 08:21
Show Gist options
  • Select an option

  • Save orcchg/691bad6e2a2f0f9db05a8be34595bb59 to your computer and use it in GitHub Desktop.

Select an option

Save orcchg/691bad6e2a2f0f9db05a8be34595bb59 to your computer and use it in GitHub Desktop.
class StockListViewModelFactory @Inject constructor(
private val provider: Provider<StockListViewModel>
) : ViewModelProvider.Factory {
@Suppress("Unchecked_Cast")
override fun <T : ViewModel> create(modelClass: Class<T>): T =
provider.get() as T
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment