While the correct solution is to save the text and attach it to the label later in viewDidLoad or something else, to test the sentences, you can work around the problem by forcing the destinationViewController to build itself from the storyboard by calling its view property like:
override func prepare(for segue: UIStoryboardSegue, sender: Any?){ if (segue.identifier == "TestViewController") { var vc:FirstViewController = segue.destination as! TestViewController print(vc.view) vc.testLabel.text = "Hello World!" } }
made for Swift 3.0 with love
source share