Storyboard navigation from code MacOS

77 views Asked by At

How can I open the ViewController window through the code? Or do I need to create an NSWindow for this ViewController?

2

There are 2 answers

3
Satendra dagar On

There is no direct way to push the controller, instead you have to write your own code for view animation and view control addition. In swift we can achieve it as following:

func addSSChildViewController(child:NSViewController){
  let subView = child.view;//Child
  let parent = self.view;//Parent
  self.addChildViewController(child)
  parent.addSubview(subView)

}

Where self is parent NSViewController inherited class.

0
Nikita Goncharuk On

Ok, I found a workaround for my problem: method PerformSegue("SignInSegue", this); I set the segue identificator in storyboard(Xcode) and then use it in method.