Skip to content

Instantly share code, notes, and snippets.

@RBusarow
Last active April 20, 2019 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RBusarow/422364126bf1c6412ae3d0238cf38a49 to your computer and use it in GitHub Desktop.
Save RBusarow/422364126bf1c6412ae3d0238cf38a49 to your computer and use it in GitHub Desktop.
Injecting a CoroutineScope into a ViewModel using a common viewModelFactory lambda
viewModelFactory {
val scope = SupervisorCoroutineScope(Dispatchers.Default)
MyViewModel(MyRepository(scope), scope)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment