Last active
September 22, 2020 18:24
-
-
Save seanghay/7eeb6b84710f2820f9baca0c5b9855b7 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 -> | |
result.doIfSuccess {items -> | |
adapter.submitList(items) | |
} | |
result.doIfFailure {message, throwable -> | |
showErrorMessage(message ?: "Unknown error message") | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment