-
Notifications
You must be signed in to change notification settings - Fork 919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Returning LiveData from UseCases #90
Comments
I tend to return Not sure why you'd want to return LiveData from a usecase. |
LiveData is associated with the lifecycle of the activity/fragment and generally used between viewmodel - activity/fragment communication. To observe something in usecase, we could make use of coroutine's |
UseCases shouldn't even be stateful. 🤔 That's why LiveData.onActive is powerful, although it'd allow you to lose results if you try to emit multiple events rather than just success/error. But you don't need LiveData for a success/error. |
Hello,
This project was such an immense Clean Architecture learning tool for me. I'd like to ask what would be a way of returning LiveData from a use case, for example, returning
LiveData<List<Movie>>
from GetMovies use case and displaying it in MoviesFragment?
Thanks.
The text was updated successfully, but these errors were encountered: