VIPER Architecture Tutorial (Android/Kotlin)
In this post, I will teach you about the VIPER Architecture tutorial in Android Studio with the use of Kotlin.
Why the VIPER Architecture?
if you are confused that why the VIPER Architecture we are using?. We can use other Architectures Like MVP, MVVM, or Clean Architecture.
Well, that’s completely up to you and your project requirements. There is no perfect architecture that is fit for all needs. Every architecture has more or less the same features and the most important thing is code separations for better understanding.
Project Intro
This project teaches you how to use the VIPER Architecture In Android using Kotlin.In this project, we are using the themoviedb.org
Within the framework of an Android app, the VIPER layers are assigned according to the following scheme:
Files description
Views
The View corresponds to an Activity or Fragment in the app. A goal is to make the View as dumb as possible so that it only takes care of showing the UI.
Interactor
The Interactor takes care of performing any action when the Presenter says to.
Presenter
The Presenter acts as a “Head-of-Department”. In other words, it commands any action making use of the Interactor, tells the View to display content, and orders the navigation to other screens using the Router.
SplashPresenterMainPresenterPopularPresenterTopRatedPresenterUpcomingPresenterDetailPresenter
Entity
The Entity represents the app data. In short, it acts likes the Model in the MVP architecture pattern.
Router
The Router handles navigating to other screens during the app lifecycle. Every view has a router within so please check the views.
These are the main components of VIPER Architecture. In this project, we use the Fuel HTTP library and for persistence storage, we are using the Room Database.
You can use another networking library like Retrofit or Volley