title: Accessing IBOutlet from another class
body: <p>I am calling a class function from my <code>ViewController</code> class like this:</p>
  
  <pre><code>Buttons.set_cornerRadius(10)
  </code></pre>
  
  <p>I have another <code>.swift</code> file where I have the function declared:</p>
  
  <pre><code>class Buttons {
  
        class func set_cornerRadius(radius: CGFloat) {
            ViewController().someButton.layer.cornerRadius = radius
        }
  }
  </code></pre>
  
  <p>When I'm trying to run this it throws the error: <code>"Unexpectedly found nil while unwrapping an optional Value"</code>.</p>
  
  <p>I checked the <em>Storyboard-IBOutlet</em> connections already. Everything is connected right.<br>
  If I call the method in the same class like this, everything works:</p>
  
  <pre><code>class ViewController: UIViewController {
  
      @IBOutlet weak var someButton: UIButton!
  
      override func viewDidLoad() {
          super.viewDidLoad()
          set_cornerRadius(10)
      }
  
      func set_cornerRadius(radius: CGFloat) {
          someButton.layer.cornerRadius = radius
      }
  }
  </code></pre>
  
  <p>How can I fix this? What am I doing wrong/not understanding right?</p>
  
  <p>Thanks in advance.</p>