Hi I'm trying to present UiSplitViewController from UiViewController. I'm doing some search in UiViewController and based on result I display UiSplitViewController. How can I do it programatically? So far I tried 3 methods after googling
1.self.performSegue(withIdentifier: "SearchComplete", sender: self)
2.self.present(PrimarySplitViewController(), animated: true, completion: nil)
3.let detailViewController = self.storyboard?.instantiateViewController(withIdentifier: "SplitView") as! UISplitViewController
self.splitViewController?.viewControllers[1] = detailViewController
None of the above methods have worked how can I solve this. Thank you.
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = mainStoryboard.instantiateViewController(withIdentifier: "SplitView") as! UISplitViewController
UIApplication.shared.keyWindow?.rootViewController = viewController
You have to set root view controller