Renato Stauffer
Aug 27, 2017 · 2 min read

Hi Andrei

Thank you for your answer :)

My question was more about the role of the router than the data flow in VIPER. So where do you inject the router? In the presenter only? This seems to be an option when the routing is view driven. But what if your routing is more business logic driven?

Uber seems to have recognized this problem and created their own VIPER like architecture to account for this problem. Their architecture is called RIBlets and uses a more business logic driven routing approach (https://eng.uber.com/new-rider-app/).

In their approach they have a minimum condition for a module:

  • Router (for navigation)
  • Interactor (to take care of business logic)
  • Builder (responsible to build the module)

Additionally you can add a ViewController and a corresponding presenter to your module. This addresses the problem when your module composes of business logic only, without a view. I mean what do you do in VIPER when your module actually does not have a view? You can’t inject the router, because there should be no presenter (what would be the point to have a presenter without a view? Pretty pointless, right?). So how do you guys account the following problems in VIPER:

  1. What do you do when the module you create does not have a view?
  2. What do you do when your routing is business logic driven and not view driven?

After doing some projects in VIPER these two arguments seem to be my two biggest pain points. Also you have to touch a lot of different classes when implementing changes in your existing code base. But this sort of comes with the architecture and I think this is a good trade of in favor of clear responsibility separation. What do you guys think?

Regards
Renato

P.s.: I also think a VIPER module should be created by a builder / factory or something alike. This gives an even better separation of concern and Uber seems to follow this approach too in their RIBlet architecture. Check out this great talk about VIPER with B (B for builder): https://academy.realm.io/posts/break-the-monoloth-with-b-viper-modules/

Also this Uber talk is good to get to know the RIBlet architecture: https://www.youtube.com/watch?v=Q5cTT0M0YXg

)

    Renato Stauffer

    Written by