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)
}