I am trying to do the following and could not add a new view to the viewcontrollers. Is this the only way to present a view controller? Can't add a view from other views? Viewboard viewcontrollers?
let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "customView") as! CustomViewController
self.present( viewcontroller , animated: true, completion: nil)
let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "customView") as! CustomViewController
vc.view.frame = self.view.frame
self.view.addSubview(vc.view)
source
share