VIPER Architecture and Solid Principles in iOS

Pedro Alvarez
The Startup
Published in
11 min readMar 28, 2020

Image from

In iOS development, as in any other mobile technology, most beginners start using as main architecture of their projects the very famous MVC(Model-View-Controller) or "Massive View Controller" as I like to call it. For first starters , I think this is the best architecture to learn due to its simplicity and low number of layers to take care about. For small projects, everything may work fine, since you don't have to care about several tests, there will not be huge and complex bugs and a few number of classes and structs may be enough.

MVC is the default architecture every Xcode project is made on. When you start something like a "Hello World" project on Xcode, all the MVC is ready for you: there is already a class representing the controller of your first screen(UIViewController), you have a storyboard with the interface of your initial view, and any other class that does not belong to the UIKit framework shall be seen as the model

The problem is, when you are working together with a bigger team in an app for a huge company, all care is little..Now you are working with a team of five developers, creating a new feature for a big application, like a payments app. Now you are managing other people's money and identities, so a lot of tests and complex code are coming into action. For this scenario, the traditional MVC pattern is not useful anymore, because it becomes very hard to fulfil the SOLID principles, which require every layer, class or struct to be independent of the other ones and do exactly what they mean.

The MVC pattern consider 3 layers

  • View: All the user interface, views, containers, buttons, text fields and any other class that represents some component the user shall see.
  • Model: The entities that build the logic of your application, every data model that takes part on the Entity-Relationship diagram of your system, like a person, an object, a user account, etc. Each class is only a data aggregation.
  • Controller: What links the previous two layers. The controller manipulates all data within the models and shows it through the View layer. It also "listens" to user events with the UI and reflects it into the model layer.

Pedro Alvarez
The Startup

iOS | Android Developer - WWDC19 scholarship winner- Blockchain enthusiast