Created
January 12, 2017 08:27
-
-
Save SylarRuby/e7fb673b94e5c364b63dca2351d30396 to your computer and use it in GitHub Desktop.
LoginVC with a passed params as string
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
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