Christopher Elías
07/21/2020, 5:28 PMVincent Williams
07/21/2020, 6:52 PMChristopher Elías
07/22/2020, 6:43 PMVincent Williams
07/23/2020, 7:23 PMonClear
or onViewDestroy
, or by making use of the android provided lifecycleScope
or viewModelScope
(although I wouldnt suggest the latter option)Christopher Elías
07/24/2020, 4:30 AMpresentation/ui
level with DataBinding, reduce the verbosity of your views. Also, I never said that LiveData "persist" the data even if the OS Kill the app, we all know that the "ViewModel" can't survive that (but now it actuallty work with onSaveInstance so is not "imposible" any more), I said persist it as long as the lifecycle owner is "alive"
For the purpose of the example It's just a combination of libraries which you can or can not use in your projects, not a MUST TO, if you are fine working only with coroutines and not livedata or viceversa, it's ok. Also why wouldn't you use viewModelScope
?Vincent Williams
07/24/2020, 6:01 PMChristopher Elías
07/25/2020, 6:11 AMVincent Williams
07/28/2020, 8:21 PMprivate val _viewstate: MutableStateFlow<ViewState> = MutableStateFlow(ViewState.Idle)
val viewState: StateFlow<ViewState> = _viewstate
viewState.collect { }
from your fragment class to receive the events