Skip to content

Instantly share code, notes, and snippets.

@fergusonm
Created December 22, 2021 15: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 fergusonm/5ef6d0793d9419b2a3f6ff9d048a871e to your computer and use it in GitHub Desktop.
Save fergusonm/5ef6d0793d9419b2a3f6ff9d048a871e to your computer and use it in GitHub Desktop.
View model UI stateflow
class MyViewMode: ViewModel() {
data class ViewState(
val someUIProperty: String = "",
val someOtherUIProperty: Int = 1,
)
private val _viewState = MutableStateFlow<ViewState>(ViewState())
val viewState = _viewState.asStateFlow()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment