Skip to content

Instantly share code, notes, and snippets.

@robertmryan
Last active October 25, 2016 17:03
Show Gist options
  • Save robertmryan/e1818a7e43c476d507408a2d6f3f5445 to your computer and use it in GitHub Desktop.
Save robertmryan/e1818a7e43c476d507408a2d6f3f5445 to your computer and use it in GitHub Desktop.
Follow up with Mukul More at http://stackoverflow.com/a/23891481/1271826
import UIKit
class ChildViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
print("ChildViewController.viewDidLoad")
}
}
import UIKit
class ViewController: UIViewController {
// in Swift 3
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
print("ParentViewController.prepareForSegue: \(segue.identifier ?? "")")
}
// or in Swift 2
//
// override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// print("ParentViewController.prepareForSegue: \(segue.identifier ?? "")")
// }
}
@robertmryan
Copy link
Author

When I did this with embed segue (i.e. I dragged "container view" from object library onto a storyboard scene, the output was:

ParentViewController.prepareForSegue: EmbedSegue
ChildViewController.viewDidLoad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment