why it says "this class is not key value coding-compliant for the key forgotPassword.'?"

I want to use segue when I click the forget password icon , Iit may open "ForgotPasswordEmailCheckController" view, my code is running but it throw error like "Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<MyApp.LoginViewController 0x7fa962b13730> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key forgotPassword.'" I don't know why?

ForgotPasswordEmailCheckController:

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

LoginViewController: 

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

   

I want to use segue when I click the forget password icon ,

I do not see any segue in your code, just an IBAction call…

One of the frequent reasons for such a crash is that you miss a connection to an IBOutlet from the storyboard, or that this connection is corrupted (if you have changed a name for instance).

So, remove all connections from IN to LoginViewController and rebuild them. Do a clean build folder after, in case.

Note: you have a typo (missing an n): forgotPasswordEmailCheckCotroller. But that's not the cause of the problem.

Why don't you set directly the storyboard ID ForgotPasswordEmailCheckController directly in IB ?

You should add a tapGesture on the label and implement the action in the tapGesture.

Enable user interaction in the label.

why it says "this class is not key value coding-compliant for the key forgotPassword.'?"
 
 
Q