If you have developed Android apps recently, chances are you are familiar with Jetpack’s ViewModel and the unidirectional data flow.
Quick recap, in case you are not familiar with the unidirectional data flow term. You keep the permanent state of the screen in your ViewModel (that is retained with configuration changes, e.g. screen rotations) and you expose that state with LiveData that your view “observes” and reacts to. When you want to make a change to your screen, you notify the view model that does its business logic and emits a new value to the observing view. Long story short, data are moving only to a single direction each time, thus unidirectional.
But how does this paradigm fits into this new UI world™? In the old world, the imperative UI world, when observing a LiveData you would explicitly instruct the view to change the necessary value (e.g. myAwesomeLabel.text = newValue). How do you accomplish this since you cannot instruct directly the UI to change?
Report Story