-
-
Save hasanmohdkhan/f6c2e73c5a4e9b2f0a076a442ab6045d 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