# viper

Published articles for viper.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## VIPER Architecture for iOS Apps

DevFeed: [VIPER Architecture for iOS Apps](<https://devfeed.tech/articles/viper-architecture-for-ios-apps-24758.md>)

Original publisher: [Read original article](<https://medium.com/ymedialabs-innovation/viper-architecture-for-ios-apps-656ee687ba76?source=rss----8b5620c36355---4>)

Author: Surbhi Gupta

Published: 2023-05-18T14:59:24Z

Content type: tutorial

Language: en

Sources: [ymedialabs-innovation - Medium](<https://devfeed.tech/sources/ymedialabs-innovation-medium.md>)

Topics: [iOS](<https://devfeed.tech/topics/ios.md>), [Code](<https://devfeed.tech/topics/code.md>), [business logic](<https://devfeed.tech/topics/business-logic.md>), [ui](<https://devfeed.tech/topics/ui.md>), [navigation](<https://devfeed.tech/topics/navigation.md>), [mvc](<https://devfeed.tech/topics/mvc.md>)

Tags: [apps](<https://devfeed.tech/tags/apps.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [business-logic](<https://devfeed.tech/tags/business-logic.md>), [code](<https://devfeed.tech/tags/code.md>), [controllers](<https://devfeed.tech/tags/controllers.md>), [flow](<https://devfeed.tech/tags/flow.md>), [ios](<https://devfeed.tech/tags/ios.md>), [modular](<https://devfeed.tech/tags/modular.md>), [mvc](<https://devfeed.tech/tags/mvc.md>), [mvvm](<https://devfeed.tech/tags/mvvm.md>), [navigation](<https://devfeed.tech/tags/navigation.md>), [patterns](<https://devfeed.tech/tags/patterns.md>), [swift](<https://devfeed.tech/tags/swift.md>), [ui](<https://devfeed.tech/tags/ui.md>), [viper](<https://devfeed.tech/tags/viper.md>)

### AI overview

This tutorial explains VIPER, an architectural pattern for iOS apps. It describes how VIPER divides each module into View, Presenter, Interactor, Entity, and Router components, with separate responsibilities and delegation-based communication.

### Source excerpt

What is a Good Architecture? Architecture serves as a blueprint for a system. It provides a mechanism to communicate between various components and abstracts the complexity. It is important to separate out code components so that they are identifiable, serve a single purpose/responsibility and also fit logically. Code should be scalable, stable upon expansion, and flexible, which brings in the need for a good architecture. A good architecture not only helps in the success of the product but also allows for easy maintenance and makes people's lives easier. This article will talk about VIPER architecture, which is used to build many large projects. What is VIPER? VIPER is an architectural pattern like MVC and MVVM. One of the major issues with MVC and MVVM is bulky controllers. VIPER solves this problem by following Single Responsibility Principle and making the code more modular. Flow of Control Each module created with VIPER has five classes, each with their own responsibilities. No class does anything other than the specified role. These classes are listed below: View: It is responsible for only maintaining and displaying the view. It picks up any user interactions and passes the information to the presenter to decide the next step. Unlike other architecture patterns like MVC or MVVM, its sole responsibility is to manage and show the UI. Presenter: It is the only class that interacts with all other components except Entity. It is the decision-making engine for routing the flow. Interactor: It interacts with Entity and contains business logic. This class is where all the API calls and database interactions are added. Entity: Data model that is used by the interactor. Router: It does all the wire-framing or navigation from one module to another based on the information passed by the presenter. An ideal folder structure would be like below: Ideal Folder Structure with VIPER The communication between various components follows a delegation pattern. One component calls