I am new to Firebase and have been trying to implement a \"Sign Up\" page for my app. Currently, I am only using the email feature, just to test things out. I am able to cre
Swift 4.1 FireBase User Create/Login Steps:-
STEP 1:- Register new firebase authentication Pod in to your Podfile :
pod 'Firebase/Auth'
STEP 2:- Open terminal and install pod with your related project directory path:
pod install
STEP 3:- import firebase authentication library in your UIViewController where ever you want:
import FirebaseAuth
STEP 4:- On your Registration UIButton Action write this snippet :
Auth.auth().createUser(withEmail: (txtEmail.text ?? ""), password: (txtPass.text ?? "")) { (result, error) in
if let _eror = error {
//something bad happning
print(_eror.localizedDescription )
}else{
//user registered successfully
print(result)
}
}
STEP 5:- If you want to Sign In after Registration use this snippet on your Sign in UIButton:
Auth.auth().signIn(withEmail: (txtEmail.text ?? ""), password: (txtPass.text ?? "")) { (result, error) in
if let _eror = error{
print(_eror.localizedDescription)
}else{
if let _res = result{
print(_res)
}
}
}
Happy Codding ;)!!!!