Skip to content

Instantly share code, notes, and snippets.

@SylarRuby
Created January 12, 2017 08:27
Show Gist options
  • Save SylarRuby/e7fb673b94e5c364b63dca2351d30396 to your computer and use it in GitHub Desktop.
Save SylarRuby/e7fb673b94e5c364b63dca2351d30396 to your computer and use it in GitHub Desktop.
LoginVC with a passed params as string
import UIKit
import Firebase
import SwiftKeychainWrapper // I use this
class LoginVC: UIViewController, UITextFieldDelegate {
// Where our shortcutItem.type is stored
var params: String! = ""
// Your @IBAction button function
@IBAction func loginPressed(_ sender: Any) {
// We make sure those two fields are not empty
if let email = loginEmailInput.text, let password = loginPasswordInput.text {
FIRAuth.auth()?.signIn(withEmail: email, password: password, completion: {(user, error) in
// Your error logic goes here...
// If your user is not nil, perform some action including:
if self.params == "for example: com.github.action" {
// Go to the ActionViewController
else
// Go to default page when logged in
}
})
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment