Cannot convert value of type 'ForgotPasswordEmailCheckController.Type' to expected argument type 'UIViewController'?

I want to use segue programmaticly , but it throw error for ForgotPasswordEmailCheckController as "Cannot convert value of type 'ForgotPasswordEmailCheckController.Type' to expected argument type 'UIViewController'" Any idea?

ForgotPasswordEmailCheckController:

 class ForgotPasswordEmailCheckController: UIViewController, UITextFieldDelegate {
  var storyboardId: String {
    return (value(forKey: "ForgotPasswordEmailCheck") as? String)!
  }

LoginViewController: 


   @IBAction func forgotPassword(_ sender: Any) {
     
    let mainStoryboard = UIStoryboard(name: "Main", bundle: Bundle.main)
     
    guard let forgotPasswordEmailCheck = mainStoryboard.instantiateViewController(identifier: "ForgotPasswordEmailCheck") as?
    ForgotPasswordEmailCheckController else {
      print("Not correct password")
      return
    }
     
    navigationController?.pushViewController(ForgotPasswordEmailCheckController, animated: true)
  }
Answered by OOPer in 680820022

You need to pass an instance of UIViewController to pushViewController(_:animated:), not a type name:

    navigationController?.pushViewController(forgotPasswordEmailCheck, animated: true)
Accepted Answer

You need to pass an instance of UIViewController to pushViewController(_:animated:), not a type name:

    navigationController?.pushViewController(forgotPasswordEmailCheck, animated: true)
Cannot convert value of type 'ForgotPasswordEmailCheckController.Type' to expected argument type 'UIViewController'?
 
 
Q