I would like the keyboard to be shown without the user touch the username text field.
I found the code from How to open the keyboard automatically on UITextField?
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
textField.becomeFirstResponder()
}
So I tried this
@IBOutlet var userNameTF: UITextField!
@IBOutlet var passwordTF: UITextField!
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
userNameTF.becomeFirstResponder()
}
but it gives an error
Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value