Hi guys, just a quick question. If i pass a variable from the model to view via presenter. Does it violate the rules of MVP? Thanks!
a
Anastasia Finogenova
02/21/2020, 2:17 AM
This idea "smells" a bit 🤷
Anastasia Finogenova
02/21/2020, 2:18 AM
Maybe if you describe the use case people can suggest a better way
s
Sagar Suri
02/21/2020, 4:32 AM
View should only get state/data which it can directly show to the user. So when you pass data from model to presenter, you transform that data to either a particular UI state or something that can be directly used by the view to render.
👆 3
j
Joey
02/24/2020, 1:12 AM
Got this
Joey
02/24/2020, 1:12 AM
Thanks guys! @Anastasia Finogenova@Sagar Suri
i
Ivann Ruiz
02/25/2020, 9:53 PM
Instead of passing a reference to the View from presenter you could use the Observer pattern to react to changes in the data. We're currently using the latest from Architecture Components (
ViewModel + LiveData
) and it works really well!
You can always use rxJava and access