Skip to content

Instantly share code, notes, and snippets.

@RBusarow
Created June 21, 2019 23:17
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/e5f47a849abeecefc1c86da4b261305e to your computer and use it in GitHub Desktop.
Save RBusarow/e5f47a849abeecefc1c86da4b261305e to your computer and use it in GitHub Desktop.
Basic addition of CoroutineScope to a ViewModel
class MyViewModel : ViewModel() {
val scope : CoroutineScope = MainScope()
override fun onCleared() {
scope.cancel()
super.onCleared()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment