Created
August 25, 2026 07:11
-
-
Save jacobsapps/828e4f488db6dac7f0b1fdd4a7e8312d to your computer and use it in GitHub Desktop.
Storyboard segue navigation in Swift 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| final class MasterViewController: UIViewController { | |
| @IBAction func showDetails(sender: UIButton) { | |
| performSegueWithIdentifier("ShowDetails", sender: sender) | |
| } | |
| override func prepareForSegue( | |
| segue: UIStoryboardSegue, | |
| sender: AnyObject? | |
| ) { | |
| if segue.identifier == "ShowDetails" { | |
| let details = segue.destinationViewController | |
| as! DetailViewController | |
| details.message = "Hello from the first screen" | |
| } | |
| } | |
| } | |
| final class DetailViewController: UIViewController { | |
| @IBOutlet weak var messageLabel: UILabel! | |
| var message: String! | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| messageLabel.text = message | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment