title: Problem with triggering a segue with the "return" key on the iPhone keyboard
body: <p>Task: I have login and password text fields, what needs to be done:</p>
  <p>After entering a login in the text Field and pressing the &quot;return&quot; button, the pointer should go to the password text Field, here the &quot;return&quot; button should call <code>@IBAction func logInButtonPressed()</code> (where it checks that the password/login is correct) <strong>and will trigger the segue.</strong></p>
  <p>Here's how I did it:</p>
  <pre><code>extension MainViewController: UITextFieldDelegate {
  
      func textFieldShouldReturn (_ textField: UITextField) -&gt; Bool {
          if textField == loginTextField {
              passwordTextField.becomeFirstResponder()
          } else {
              logInButtonPressed()
              performSegue(withIdentifier: &quot;showVC&quot;, sender: nil)
          }
          return true
      }
  }
  </code></pre>
  <p><strong>Problem:
  The pointer goes from the Login text field, to the Password text field, but the &quot;return&quot; button does nothing.</strong></p>
  <p>I specified the correct Identifier,
  the &quot;Log In&quot; button itself works correctly,
  BUT the segue does not work if I use the &quot;return&quot; button</p>
  <p>What could be the problem, I have already rechecked everything a hundred times, searched for other questions on SO and found nothing.</p>
  <p><strong><a href="https://i.stack.imgur.com/BNNpe.jpg" rel="nofollow noreferrer">Photo of storyboard with segue settings</a></strong><br />
  <a href="https://i.stack.imgur.com/4kPRe.png" rel="nofollow noreferrer">code of <code>logInButtonPressed()</code></a></p>
  <p>Many thanks in advance</p>
  <p>UPD: The problem was that I didn't write a delegate for the Password text field in viewDidLoad().
  Thanks for Help!)</p>