title: Programmatically changing View Controllers without Navigation Controller Swift
body: <p>I want to switch to a new view controller when I press a button without using a navigation controller and I can't seem to be able to do this. I have looked everywhere for an answer but everything that I have found is either in objective-c, using a navigation controller, or not working at all. </p>
  
  <pre><code>func gunsoutButtonPressed(sender:UIButton!) {
      print("yay\t")
      //let encounterVC:AnyObject! = self.storyboard?.instantiateViewControllerWithIdentifier("ecounterViewController")
      //self.showViewController(encounterVC as UIViewController, sender: encounterVC)
      let encounterViewController = self.storyboard.instantiateViewControllerWithIdentifier("encounterViewController") as encounterViewController
      self.pushViewController(encounterViewController, animated: true)
  }
  </code></pre>