I have just started working with swift, i have created a subview which has a button on it, i would like to use that button to take me to my mainviewcontroller.
i have used same functionality for a different button however having a function in same file allows that button to work the code is below
var playAgainButton = UIButton(frame: CGRectMake(0, 150, 320, 40))
playAgainButton.setTitle("Play Again", forState: UIControlState.Normal)
playAgainButton.addTarget(self, action: Selector("startGame"), forControlEvents: UIControlEvents.TouchUpInside)
playAgainButton.backgroundColor = UIColor.redColor()
gameOver.addSubview(playAgainButton)
is it possible to use similar code to navigate to a different viewcontroller?
Thanks