title: How to Pass extra parameters to a custom UIView class for initialization in swift
body: <p>I'm trying to write a class that is of type UIView, but on initialization I want it to take an extra parameter, but I can't figure out how to get around the UIView needing its params instead. Any help is much appreciated!</p>
  
  <pre><code>class MenuBar: UIView {
  
      let homeController: HomeController
  
      init(controller: HomeController){
          homeController = controller
          super.init()
      }
      override init(frame: CGRect) {
          super.init(frame: frame)
  
      }
  
      required init?(coder aDecoder: NSCoder) {
          fatalError("init(coder:) has not been implemented")
      }
  
  }
  </code></pre>
  
  <p>In the ViewController I'm initializing it like this:</p>
  
  <pre><code>let menuBar: MenuBar = {
      let mb = MenuBar(controller: self)
      return mb
  }()
  </code></pre>