Swift: Firebase Chat App Part 1 - Getting Started (Real-time) - Xcode 12 - 2022
Swift: Firebase Chat App Part 2 - Log In & Register Screens (Real-time) - Xcode 12 - 2022
@objc private func didTapSignUp() {
let registerVC = SignUpViewController()
registerVC.title = "Create Account"
navigationController?.pushViewController(registerVC, animated: true)
}
class SignInViewController: UIViewController {
private let imageView: UIImageView = {
// logo
}()
private let scrollView: UIScrollView = {
// content view
}()
private let emailField: UITextField = {
// email
}()
private let passwordField: UITextField = {
// password
}()
private let signInButton: UIButton = {
// sign in
}()
...
private func setLoginViewUI() {
title = "Sign In"
view.backgroundColor = .white
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Sign Up", style: .done, target: self, action: #selector(didTapSignUp))
view.addSubview(scrollView)
scrollView.addSubview(imageView)
scrollView.addSubview(emailField)
scrollView.addSubview(passwordField)
scrollView.addSubview(signInButton)
signInButton.addTarget(self, action: #selector(loginButtonTapped), for: .touchUpInside)
emailField.delegate = self
passwordField.delegate = self
}
...
}
private func alertUserLoginError(_ message: String) {
let alert = UIAlertController(title: "Sign In Alert", message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
present(alert, animated: true)
}