title: Change ViewController MacOS Swift
body: <p>I have two view controllers in two different storyboards:</p>
  
  <p>Story board #1:<a href="https://i.stack.imgur.com/fKTQC.png" rel="nofollow noreferrer">Main.Storyboard</a></p>
  
  <p>This is connected to a class called: ViewController.swift:</p>
  
  <pre><code>import Cocoa
  class ViewController: NSViewController {
  
  //Bad Button Attempt:
      /*override func prepareForSegue(segue: NSStoryboardSegue, sender: AnyObject?) {
          //1
          let CareViewCont
          rol = segue.destinationController as! NSViewController
          //2
          self.dismissViewController(self)
      }*/
  
  
      //Rest of Default Code:
      @IBOutlet weak var findButton: NSButton!
      override func viewDidLoad() {
          super.viewDidLoad()
      }
      override var representedObject: Any? {
          didSet {
          }
      }
  }
  </code></pre>
  
  <p>Storyboard #2: <a href="https://i.stack.imgur.com/OiNbr.png" rel="nofollow noreferrer">Ashwin.Storyboard</a></p>
  
  <p>This is connected to a class called: CareViewController.swift: </p>
  
  <pre><code>import Cocoa
  class CareViewController: NSViewController {
  
  //empty
  
  }
  </code></pre>
  
  <p>Basically all I want to do is click the "Find" button in Main.Storyboard and have that switch the view controller to the one in Ashwin.Storyboard.</p>
  
  <p>I have tried copy and pasting the ViewController in Ashwin.Storyboard to Main.Storyboard, control clicking the find button, and creating a "Action Segue" but all of the action segues make a new window pop up and that's not what I want. </p>
  
  <p>I have also tried making an action listener for the "Find" button in ViewController.Swift but I couldn't make that approach work... (I have a feeling that's the solution though...)</p>
  
  <p>Please help me I'm clueless in MacOS.</p>