I am trying to present a second viewcontroller on top of the first at startup without dismissing the first. This post Swift 3 - loading multiple ViewControllers at launch certainly looks like it has the answer. It recommends:
Add in your main view controller
var secondViewController:UIViewController!
And in your viewDidLoad:
secondViewController: UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "yourIdentifier") as! SecondViewController
That's it. When you want to present it, use:
self.present(secondViewController, animated: true, completion: nil)
This third line works great if, for example, I attach it as an action to a button. However, it does not work if it is in viewDidLoad: of the first viewController. This is what I need.
How can I automatically present the second viewController on top of the first viewController at launch?