This will only work if it secondControllerprogrammatically creates its presentation. If you want to use a storyboard scene (which is much more common), you can do the following:
@IBAction func buttonPressed(sender: AnyObject) {
let controller = storyboard?.instantiateViewControllerWithIdentifier("foo")
presentViewController(controller!, animated: true, completion: nil)
}
This obviously assumes that you have specified the storyboard identifier for the destination scene.

Or you can create a segue between two scenes in IB by dragging the control from the view controller icon at the top of the first scene to the second scene:

, segue :

segue:
@IBAction func buttonPressed(sender: AnyObject) {
performSegueWithIdentifier("bar", sender: self)
}