Last active
June 27, 2020 09:55
-
-
Save seanghay/8ebc0b800123af055c025e420c36b635 to your computer and use it in GitHub Desktop.
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
/* Copyright 2020 Seanghay Yath (@seanghay) | |
SPDX-License-Identifier: Apache-2.0 */ | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
viewModel.posts.observe(viewLifecycleOwner, Observer {result -> | |
val (items) = result.withDefault { postsFromDb() } | |
adapter.submitList(items) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment