Last active
July 7, 2020 20:58
-
-
Save adam-hurwitz/dd977bccd2a7693f443df7a0bc7083ea to your computer and use it in GitHub Desktop.
Optimizing ViewModel with Lifecycle 2.2.0: Declaring VM val
This file contains hidden or 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 Fragment : Fragment() { | |
private val viewModel: SomeViewModel by viewModels() | |
private fun observeViewState() { | |
viewModel.viewState.observe(viewLifecycleOwner) { viewState -> | |
//viewState used here. | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment