Unable to change label text after presenting the view controller programmatically in swift <p>I am presenting the a view programmatically in if else statement using this code:</p> <pre><code>if (Condition) { ..... } else { var vc = self.storyboard?.instantiateViewControllerWithIdentifier("gameover") as UIViewController self.presentViewController(vc, animated: true, completion: nil) finalMsg.text="Thank you" } </code></pre> <p>So the view is getting changed but I am not able to change the text of label finalMsg which belongs to the view that I changed programmatically (gameover). </p> <p>I am getting error "fatal error: unexpectedly found nil while unwrapping an Optional value"</p> <p>Can someone help me on this? </p>