I have created a second View Controller in the main storyboard with the same view controller class. I created an outlet for this view.
If a button was clicked, I want to add this second view over the first view. How can I call this second view?
Code of secondViewController:
@IBOutlet weak var secondView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
self.view = secondView
}
override func loadView() {
super.loadView()
// Fatal error: Unexpectedly found nil while unwrapping an Optional value
self.view.addSubview(informationView)
}
Code of firstViewController, where I call the secondView and put it in a plane:
let secondViewController:UIViewController = SecondViewController()
let plane = SCNPlane(width: CGFloat(0.1), height: CGFloat(0.1))
plane.firstMaterial?.diffuse.contents = secondViewController.view
I only get a white screen, also the background color is not shown.