Skip to content

Instantly share code, notes, and snippets.

@jazzedge
Last active December 9, 2017 16:09
Show Gist options
  • Save jazzedge/6dc075af09d9922075c93abcc61c7146 to your computer and use it in GitHub Desktop.
Save jazzedge/6dc075af09d9922075c93abcc61c7146 to your computer and use it in GitHub Desktop.
See:https://makeapppie.com/2016/07/11/programmatic-navigation-view-controllers-in-swift-3-0/
Go to ViewController class and add the following method:
@IBAction func fourFiveToggleButton(_ sender: UIButton){
performSegue(withIdentifier: "mySegueIdentifier", sender: self)
}
To unwind see: https://www.andrewcbancroft.com/2015/12/18/working-with-unwind-segues-programmatically-in-swift/
01. Create an unwind action in the DESTINATION VC where you will unwind to.
@IBAction func unwindToMenu(segue: UIStoryboardSegue) {}
02. Wire up the unwind segue:
Ctrl-Drag from the VC [o] icon on top of the VC in storyboard to the EXIT icon.
Select the @IBAction set up in step 1, from the dropdown menu that appears.
03. Specify a segue identifier:
Expand the Document Outline of the storyboard and select the Unwind segue to 'Exit'
Specify its identifier in the Attributes inspector. Call it the same as the @IBAction func in step 1
04. Trigger unwind segue programmatically.
Create an @IBAction with a button on the SOURCE VC where you will unwind from and add:
self.performSegue(withIdentifier: "unwindToMenu", sender: self)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment