Last active
January 3, 2020 09:45
-
-
Save mlykotom/63489b8cf1e9ef352377ae2e19dfe54c to your computer and use it in GitHub Desktop.
Connecting The Dots :: Pure SavedState - ViewModel body simple
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SomeViewModel(/* ..ommited.. */){ | |
val counter = savedStateHandle.getLiveData("counter", 0) | |
fun onPlusClick() { | |
counter.value = (counter.value ?: 0) + 1 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment