Good day. I hope all is well. I've been struggling with trying to get this bit of code to work. Basically, it's a form verification for creating new login accounts in Firebase. The verifications work but no matter what happens is goes to the next screen to complete the login registration eventhough, the message prompt states that the account already exists. The server side isn't an issue as it will not accept duplicate login names. However, it still takes to user to the next screen no matter what. I 'm simply trying to keep the user on the current Create login screen, so that the user can try another email and only go to the next screen if it's a new email, to finish the registration. I was trying to use Function, but that didn't go well as it was ignored completely. Below is the peice of code in Swiftui. Please advise. Thanking you in advance
// Check for existing account
Auth.auth().createUser(withEmail: email, password: password) {firebaseResult, error **in**
**if** **let** e = error {
print("error")
**if** **let** error = error {
print("Error! Account already exist. \\(error.localizedDescription)")
**let** alert = UIAlertController(title: "Failed", message: "Email already associated with existing account. Please try another email or contact administator for assistance.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: **nil**))
**self**.present(alert, animated: **true**, completion: **nil**)
**return**
}
}
**let** alert = UIAlertController(title: "Success", message: "Account created.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: **nil**))
**self**.present(alert, animated: **true**, completion: **nil**)
}
********************
self.performSegue(withIdentifier: "goToFinishupaccount", sender: self)
}
***********************
// }
}
// }