Connect two View Controller in swift

Viewed 25

I have an issue with two view controllers. I have already connected these two controllers. I just want to go to the next view controller, when I press "Register", but then the simulator is showing up with a black screen and a "play" icon. I already tried to connect these two view controllers and hold ctrl down and draw a line from one view controller to the other, and then I choose show.

This is the code from the register controller:

import UIKit
import Firebase

class RegisterViewController: UIViewController {

    @IBOutlet weak var emailTextfield: UITextField!
    @IBOutlet weak var passwordTextfield: UITextField!
    
    @IBAction func registerPressed(_ sender: UIButton) {
       
        if let email = emailTextfield.text, let password = passwordTextfield.text {
            Auth.auth().createUser(withEmail: email, password: password) { authResult, error in
                if let e = error {
                    print(e)
                } else {
                    //Navigate to the ChatViewController
                    self.performSegue(withIdentifier: K.registerSegue, sender: self)
                }
            }
        }
    }
    
}

This is the code from the view controller:

import UIKit
import Firebase

class MainViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
    
       
    }
}

I already have a chat view controller, but I want to go through the Main View controller first.

0 Answers
Related