VIPER Design Pattern or Architecture? — Swift

Part 2:- Basics of Clean Architecture And Comparison Between VIPER And Clean Architecture.

To know about the basics of VIPER, check out part1 of the Series And Let’s move on to the next part which is short and interesting .

From the previous series, The Simplified Diagram of the Weather App:

Figure 1

Note: The software product is the combination of all the modules. And Good Architecture allows us to achieve both stability and speed without trade-offs.VIPER was defined as an iOS implementation of the clean
architecture by
Robert C.Martin (Uncle Blob).

So, What is Clean Architecture? I would recommend to go through the above link to have deep understanding and here we will discuss Clean architecture in brief.

Figure 2

In the above figure, we can see that UIKit is used as external Interfaces and the arrows points inside which means controllers and presenters uses it from external Interfaces.
Let’s see the Clean Architectural Diagram for Weather App which is developed using VIPER:

In the above figure, UIKit is used as internal interfaces and the arrows points inside which means controllers uses it internally.

Comparing figure 2 and figure 3 we can Conclude that :

❖ Is VIPER is an architecture.Well, it depends on your interpretation of architecture in ours. No it’s not. It’s like an architectural design pattern. And it’s a good one.
❖ So, VIPER is a good design pattern and use it with care.

Conclusion

Here, we are done with building a sample Weather application Using VIPER and brief explanation of Clean Architecture . Hope this is helpful. Thank you. Happy coding.!!🙌

References :-
https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html
https://www.objc.io/issues/13-architecture/viper/
https://github.com/mutualmobile/VIPER-SWIFT

iOS Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store