This file contains 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
class LoginViewController: UIViewController,LoginView { | |
var loginPresenter : LoginPresenter? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
loginPresenter = LoginPresenter() | |
loginPresenter?.attachView(view: self) | |
} | |
This file contains 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
class LoginPresenter: BasePresenter { | |
typealias View = LoginView | |
var loginView : LoginView? | |
func attachView(view: LoginView) { | |
self.loginView = view | |
} | |
func detachView() { |
This file contains 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
protocol BasePresenter { | |
associatedtype View | |
func attachView(view : View) | |
func detachView() | |
func destroy() | |
This file contains 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
protocol LoginView { | |
func navigateToHome() | |
func showLoading() | |
func hideLoading(); | |
func showMessage(message: String) | |
This file contains 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
class MainActivity : AppCompatActivity() { | |
private var toolBar: Toolbar? = null | |
private var container: ViewGroup? = null | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
coordinatorLayout { | |
fitsSystemWindows = true | |
appBarLayout { |
This file contains 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
class LoginActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
LoginActivityUI().setContentView(this) | |
} | |
} | |
class LoginActivityUI : AnkoComponent<LoginActivity> { |
This file contains 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
package com.sample.tryanko | |
import android.support.v7.app.AppCompatActivity | |
import android.os.Bundle | |
import kotlinx.android.synthetic.main.activity_main.alert_dialogue | |
import kotlinx.android.synthetic.main.activity_main.button | |
import kotlinx.android.synthetic.main.activity_main.coordinatorLayout | |
import kotlinx.android.synthetic.main.activity_main.dialogue | |
import kotlinx.android.synthetic.main.activity_main.longToast | |
import kotlinx.android.synthetic.main.activity_main.longsnackbar |
This file contains 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
protocol BaseView { | |
func showError(message : String) | |
} |
This file contains 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
import UIKit | |
protocol BasePresenter { | |
// Protocol does not support generics, so we have added associated type, | |
// Anything that conforms to BasePresenter | |
associatedtype View | |
func attachView(view : View) | |