title: having difficulties calling functions in a different view controller
body: <p>I'm having some difficulties calling a function in a view controller that is different than the one it was declared in. I've tried some methods from different posts on the site, but none of them are working for me. </p>
  
  <pre><code>class Housekeeping: UIViewController {
  
  override func viewDidLoad() {
      super.viewDidLoad()
  }
  
  var balance = 387563 //remove later, arbitrary value for testing
  var username = "kaplan"
  @objc func addTop() {
      let balanceLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 150, height: 30))
      balanceLabel.text = "\(balance)"
      balanceLabel.textAlignment = .center
      balanceLabel.font = UIFont.boldSystemFont(ofSize: 20)
      balanceLabel.center = CGPoint(x: self.view.center.x*2-95, y: 50)
      balanceLabel.textColor = UIColor(displayP3Red: 160/255, green: 160/255, blue: 160/255, alpha: 1.0)
      view.addSubview(balanceLabel)
  
      let genechipImg = UIImageView(image: UIImage(named: "genechip"))
      genechipImg.frame = CGRect(x: 0, y: 0, width: 30, height: 30)
      genechipImg.center = CGPoint(x: balanceLabel.center.x + 60, y: balanceLabel.center.y)
      view.addSubview(genechipImg)
  
      let usernameLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 130, height: 30))
      usernameLabel.text = "Dr. \(username)"
      usernameLabel.textAlignment = .center
      usernameLabel.font = UIFont.boldSystemFont(ofSize: 20)
      usernameLabel.center = CGPoint(x: 80, y: 50)
      usernameLabel.textColor = UIColor(displayP3Red: 160/255, green: 160/255, blue: 160/255, alpha: 1.0)
      view.addSubview(usernameLabel)
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This addTop function was declared in a view controller named <code>Housekeeping</code> and I'm trying to call it on a second view controller named <code>GeneLibrary</code> but I can't figure out how. As you can see, the function doesn't do much just adds two labels at the top, which I'm trying to add on a subsequent view controller. Here's the second view controller I'm trying to pass it to:</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
  
      override func viewDidLoad() {
          super.viewDidLoad()
          print("gene library scene running")
      }
  }
  </code></pre>
  
  <p>If anybody could please provide some insight I'd really appreciate it. Stay safe everybody, thanks!</p>