Upvote:2

let myVC = storyboard.instantiateViewController(withIdentifier: "myVC") as! myViewController

More Answer related to the Same Query

Upvote:0

DispatchQueue.main.async{
        let storyboard = UIStoryboard(name:"Main", bundle:nil)
        let myVC = storyboard.instantiateViewController(withIdentifier: "myVC") as! myViewController
            if let text = newText{
               myVC.theVariable = text
            }
        }

class NextViewController: UIViewController {
    var theVariable = ""

    override func viewDidLoad() {
        super.viewDidLoad()

        lblToUpdate.text = theVariable
    }

Upvote:0

DispatchQueue.main.async{
   if let navroot = self.window!.rootViewController as? NavigationController{
     if let childvc = navroot.childviewcontrollers.first {
         if let text = newText{
            childvc.text?.text = text
         }
     }

   }
}

Credit Goes to: stackoverflow.com

Related question with same questions but different answers