Skip to content

Instantly share code, notes, and snippets.

@mattmook
Created July 14, 2021 10:50
Show Gist options
  • Save mattmook/cfaecf5040f032d484739a40e45a075d to your computer and use it in GitHub Desktop.
Save mattmook/cfaecf5040f032d484739a40e45a075d to your computer and use it in GitHub Desktop.
The state of MVI on Android - ReduxKotlin - subscribe
lifecycleScope.launchWhenCreated {
suspendCancellableCoroutine { continuation ->
val unsubscribe = viewModel.store.subscribe {
render(viewModel.store.state)
}
continuation.invokeOnCancellation {
unsubscribe()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment