title: Modify IBOutlet property from outside of viewDidLoad - Xcode Storyboards
body: <p>I have a separate class which when called upon updates the ToolTip (a text property) for an NSButton in a pistonViewController via its IBOutlet.
  However, whenever I try to perform the action, I get the error</p>
  <blockquote>
  <p>&quot;Unexpectedly found nil while implicitly unwrapping an Optional value&quot;</p>
  </blockquote>
  <p>since <code>pistonViewController.piston.tooltip</code> didn't work, I created an instance above the class:</p>
  <pre><code>let pistonView = pistonViewController();
  </code></pre>
  <p>and then from within the separate class called <code>pistonView.set_piston();</code></p>
  <pre><code>func set_piston(index: Int) {
          piston1.toolTip = &quot;yay it worked!&quot;;
      }
  </code></pre>
  <p>I get the same error: found nil.</p>
  <p>How to get the correct instance of the pistonViewController (the one that appears on viewDidLoad) so that piston1 will not be nil?</p>
  <p>There is <a href="https://stackoverflow.com/questions/45109466/how-can-i-access-iboutlet-in-another-class">this solution</a>, but it looks needlessly complex. <a href="https://stackoverflow.com/questions/35358225/how-can-i-access-iboutlet-in-another-class-in-swift">This one</a> appears to only work on iOS, using a storyboard.InstantiateViewController command that does not work on MacOS. <a href="https://stackoverflow.com/questions/38046453/changing-the-values-of-an-iboutlet-from-another-class">This MacOS solution</a> is poorly explained and does not appear to work.</p>