I am trying with the following and failed to add new viewcontrollers view. Is it only way to present view controller ? Cant we add view from other storyboard viewcontrollers view?
//Working
let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "customView") as! CustomViewController
self.present( viewcontroller , animated: true, completion: nil)
//Not working
let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "customView") as! CustomViewController
vc.view.frame = self.view.frame
self.view.addSubview(vc.view)
You need to also add
CustomViewController
asChildViewController
in your current Controller.