Last active
November 17, 2017 09:02
-
-
Save hilfritz/2157e24e952645cf378f5a3010dadcbf to your computer and use it in GitHub Desktop.
Viper explanations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //https://cheesecakelabs.com/blog/using-viper-architecture-android/ | |
| class LoginContracts { | |
| interface View { | |
| //1. this are the methods the presenter the contract can call (for displaying data) | |
| // - implemented by fragment/activity/view | |
| fun goToHomeScreen(user: User) | |
| fun showError(message: String) | |
| } | |
| interface Presenter { | |
| //1. handles the inputs from the views | |
| // - includes lifecycle events,implemented by presenter | |
| fun onDestroy() | |
| fun onLoginButtonPressed(username: String, password: String) | |
| } | |
| interface Interactor { | |
| //1. methods for the Contract (to perform the login process) | |
| fun login(username: String, password: String) | |
| } | |
| interface InteractorOutput { | |
| //1. methods for the interactor output | |
| //- implemented by presenter | |
| fun onLoginSuccess(user: User) | |
| fun onLoginError(message: String) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment