Skip to content

Instantly share code, notes, and snippets.

@elihart
Created November 20, 2019 17:19
Show Gist options
  • Save elihart/2a6b3865852bc0c68760c69fca06347f to your computer and use it in GitHub Desktop.
Save elihart/2a6b3865852bc0c68760c69fca06347f to your computer and use it in GitHub Desktop.
MvRx Hello World Example
data class MyState(val text: String = "Hello World") : MvRxState
class MyViewModel(state: MyState) : BaseMvRxViewModel<MyState>(state)
class MyFragment : MvRxFragment() {
val viewModel: MyViewModel by fragmentViewModel()
fun epoxyController() = simpleController(viewModel) { state ->
textRow {
id("title")
text(state.text)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment