title: Swift: Navigate to new ViewController using button
body: <p>I have a single view application which connects to parse and verifies user log in information and updates a UILabel saying "Yay, You've logged in sucessfully" - Now I want it to navigate to a new view (Which will be the main part of the app). </p>
  
  <p>I have dragged a new view controller onto the storyboard and Ctrl-Drag the button and linked it to the new controller with <strong>show</strong>. However, the moment I load the app and click the button it goes straight to the new view. I need it to only go there if the right part of the if-else statement is triggered. </p>
  
  <p>Does this make sense? Thank for any help guys. much appreciated. </p>
  
  <p>EDIT</p>
  
  <p>The if statement is:</p>
  
  <pre><code>if usrEntered != "" &amp;&amp; pwdEntered != "" {
          PFUser.logInWithUsernameInBackground(usrEntered, password:pwdEntered) {
              (user: PFUser!, error: NSError!) -&gt; Void in
              if user != nil {
                  self.messageLabel.text = "You have logged in";
              } else {
                  self.messageLabel.text = "You are not registered";
              }
          }
      }
  </code></pre>
  
  <p>and its located in the ViewController.swift file</p>