I'm testing the login of my app using basic email and password authentication via Cloud Firestore.
Here's the code:
import UIKit
import Firebase
class LoginViewController: UIViewController {
@IBOutlet weak var EmailTextField: UITextField!
@IBOutlet weak var PasswordTextField: UITextField!
var docRef: DocumentReference!
override func viewDidLoad() {
super.viewDidLoad()
docRef = Firestore.firestore().document("users/credentials")
// Do any additional setup after loading the view.
}
@IBAction func SMLoginTapped(_ sender: Any) {
guard let EmailText = EmailTextField.text, !EmailText.isEmpty else { return }
guard PasswordText = PasswordTextField.text, !PasswordText.isEmpty else { return }
let SaveData: [String: Any] = ["email": EmailText, "password": PasswordTextField]
docRef.setData(SaveData) { (error) in
if let error = error {
print("Oh no! Got an error: \(error.localizedDescription)")
} else {
print("Data has been saved to Firestore!")
}
}
}
print("Login button tapped!")
self.performSegue(withIdentifier: "SecondViewSegue", sender: self)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
I'm getting the following errors:
line 20: Use of unresolved identifier 'PasswordText"; did you mean 'PasswordTextField'?
line 20: Replace 'PasswordText' with 'PasswordTextField'
When I do the recommended debugging above, I still get errors. Could someone help me find the issue here?