title: Loading a XIB file to a UIView Swift
body: <p>I am trying to load my <code>XIB</code> file into a <code>UIView</code> but I am having some trouble. I have the required override functions but they seem to be crashing. Saying this error, warning: </p>
  
  <blockquote>
    <p>could not load any Objective-C class information. This will
    significantly reduce the quality of type information available.</p>
  </blockquote>
  
  <p>I was wondering if someone could show me how to properly load the <code>XIB</code> file into a <code>UIView</code></p>
  
  <pre><code>import UIKit
  
  class Widget: UIView {
  
      let view = UIView()
  
      override init(frame: CGRect) {
          super.init(frame: frame)
  
          //call function
  
          loadNib()
  
      }
  
      required init?(coder aDecoder: NSCoder) {
          super.init(coder: aDecoder)
  
          loadNib()
  
          //fatalError("init(coder:) has not been implemented")
      }
  
      func loadNib() {
          let bundle = NSBundle(forClass: self.dynamicType)
          let nib = UINib(nibName: "nib", bundle: bundle)
          let view = nib.instantiateWithOwner(self, options: nil)[0] as! UIView
          view.frame = bounds
          view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
          self.addSubview(view);  
      }
  }
  </code></pre>