MVVM vs VIPER patterns

Could someone compare and contrast MVVM and VIPER?

Hi @evs718, I’ll briefly share the difference between the two but for the most part they are both architectures used in development. There is a great book here called Advanced iOS App Architecture that covers MVVM and other patterns.

MVVM:

  • View delivers user actions to view model .
  • View model handles these actions and updates its state.
  • View model then notifies the view , either with data binding or manually using delegation or blocks.

VIPER:

  • View delivers user actions to presenter .
  • Presenter then delivers these actions to either interactor or router .
  • If the action requires computation, interactor handles it and returns the state to the presenter .
  • Presenter then transforms this state to presentation data and updates the view .
  • Navigation logic is encapsulated in router and presenter is responsible from triggering it.

Best,
Gina

Could you just mention a few salient benefits of the viper pattern? I understand mvvm, but I don’t understand what benefits viper has that would make me want to choose or even learn that pattern.

VIPER has a benefit of providing clear locations for app logic so you might find the view controllers to be leaner than what you might see in a different design pattern and easier to test which could overall lead to easier maintenance. With design patterns it might be helpful to just try out tutorials that way you can get a better grasp of the concepts but if you choose not to that’s alright too!

Best,
Gina

It sounds like there is no significant advantage to viper over MVVM, and MVVM is simpler in description.

1 Like

This topic was automatically closed after 166 days. New replies are no longer allowed.