VIPER: Taming Massive iOS View Controllers

VIPER is a strict architectural pattern that tames "Massive View Controllers" by splitting features into five layers: View, Interactor, Presenter, Entity, and Router. It's used in large iOS apps to make business logic and navigation explicitly testable.
Why it exists
Standard iOS MVC often leads to "Massive View Controllers," where controllers become bloated with application logic, data formatting, and navigation code. This makes them hard to test and maintain. VIPER was created as an application of Clean Architecture to solve this by enforcing a strict separation of concerns.
The mental model
Think of VIPER as building an app around specific user tasks, or "use cases." For each task, you assemble a team of five specialists: the View, Interactor, Presenter, Entity, and Router. Each specialist has a single job and communicates through clear protocols, preventing any one component from becoming a "know-it-all" like a massive view controller.
How it works
VIPER breaks down a feature into five distinct components with single responsibilities. First, the View is a passive UI layer that displays what the Presenter tells it and forwards user actions. Second, the Interactor contains the pure business logic for a use case, like fetching or calculating data. Third, the Presenter acts as a middleman, taking raw data from the Interactor, formatting it for display, and passing it to the View. Fourth, Entities are the simple data model objects used by the Interactor. Finally, the Router (or Routing) manages all navigation logic, deciding which screen to show next.
When to use it
Use VIPER in large, long-lived applications with complex features and a strong need for high test coverage. Its strict separation makes it easier for large teams to work in parallel on different layers without creating conflicts. It shines when you need to test business logic independently of the UI.
When not to use it
Avoid VIPER for small-to-medium sized projects or prototypes. The amount of boilerplate code required to set up the five components and their communication protocols for every screen can significantly slow down development. Simpler patterns like MVC or MVVM are often a better fit in these cases.
One canonical example
In a to-do list app, a use case might be "group to-dos by date." The Interactor would contain the logic to fetch and sort the to-do Entities. The Presenter would request this sorted list, format the dates into user-friendly strings (e.g., "Today"), and tell the View to display them. If the user taps a to-do item, the View tells the Presenter, which then tells the Router to navigate to the detail screen for that item.
Interview question
Which VIPER component is responsible for formatting data for presentation and directing the View on what to display?
- a.The Interactor, as it contains the core business logic for data processing.
- b.The Presenter, as it acts as a middleman between business logic and the passive UI.Correct
- c.The View, as it is the direct interface responsible for rendering information to the user.
- d.The Router, as it orchestrates the flow of information between different screens.
Why? this is the answer
The Presenter is explicitly described as taking raw data from the Interactor, formatting it for display, and passing it to the View. The Interactor handles pure business logic, and the View is a passive display layer.
Just read this? Test yourself on what you have been reading.
Read the original → objc.io
- #ios
- #architecture
- #swift
- #viper
- #clean architecture
You just looked this up. Could you explain it out loud?
That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on ios — each one lists the topics its interview covers.
See open roles