Skip to content

Instantly share code, notes, and snippets.

@hilfritz
Last active November 17, 2017 09:02
Show Gist options
  • Select an option

  • Save hilfritz/2157e24e952645cf378f5a3010dadcbf to your computer and use it in GitHub Desktop.

Select an option

Save hilfritz/2157e24e952645cf378f5a3010dadcbf to your computer and use it in GitHub Desktop.
Viper explanations
//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