Skip to content

Instantly share code, notes, and snippets.

@rajajawahar
Created May 29, 2018 00:09
Show Gist options
  • Save rajajawahar/118c12ae9e6cd62953bbeb1a013a26e0 to your computer and use it in GitHub Desktop.
Save rajajawahar/118c12ae9e6cd62953bbeb1a013a26e0 to your computer and use it in GitHub Desktop.
class LoginPresenter: BasePresenter {
typealias View = LoginView
var loginView : LoginView?
func attachView(view: LoginView) {
self.loginView = view
}
func detachView() {
}
func destroy() {
}
func emailValid(emailAddress : String) -> Bool {
let emailRegEx = "[A-Z0–9a-z._%+-]+@[A-Za-z0–9.-]+\\.[A-Za-z]{2,}"
let emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx)
return emailTest.evaluate(with: emailAddress)
}
func login(username : String, password : String){
//Make an API Call from the given username and password
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment