I am a totally new to swift. I am trying to set up a screen with 3 textfields so the user can enter data. I used the code line: nameField.delegate = self
, but I always get an error message: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
. Could anybody help me fixing that problem? :)
I have already tried to force unwrap the value, but that did not work.
private func configureTextFields(){
nameField.delegate = self
amountField.delegate = self
dateField.delegate = self
}
I also set up an extension at the bottom. Maybe I did a mistake there:
extension ViewController : UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
}
.