Custom view created with Xib not working in Interface Builder
<p>I've created a custom view with the help of an <code>.Xib</code> file. When I create the view programmatically and add it to my ViewController it works just fine. But if I create a UIView in Interface Builder and set the class to my <code>CustomView</code> class and run it, it doesn't show up.</p>

<p>This is the Code in my <code>CustomView</code> class:</p>

<pre><code>@IBOutlet var view: UIView!

init() {
    super.init(frame:CGRect.zero)
    setup()
}

override init(frame: CGRect) {
    super.init(frame: frame)
    setup()
}

required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)!
    setup()
}


func setup() {
    Bundle.main.loadNibNamed("CustomView", owner: self, options: nil)
    view.backgroundColor = UIColor(red: 10.0/255.0, green: 30.0/255.0, blue: 52.0/255.0, alpha: 1.0)
    view.translatesAutoresizingMaskIntoConstraints = false
    view.isUserInteractionEnabled = true
}


func presentInView(superView:UIView) {

    superView.addSubview(view)

    // Define Constraints
    let height = NSLayoutConstraint(item: view, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: 90.0)
    view.addConstraint(height)

    let topConstraint = NSLayoutConstraint(item: view, attribute: .top, relatedBy: .equal, toItem: superView, attribute: .top, multiplier: 1.0, constant: 0.0)
    let leftConstraint = NSLayoutConstraint(item: view, attribute: .left, relatedBy: .equal, toItem: superView, attribute: .left, multiplier: 1.0, constant: 0.0)
    let rightConstraint = NSLayoutConstraint(item: view, attribute: .right, relatedBy: .equal, toItem: superView, attribute: .right, multiplier: 1.0, constant: 0.0)
    superView.addConstraints([topConstraint,leftConstraint, rightConstraint])
}
</code></pre>

<p>In the <code>.Xib</code> file I set the class for the <code>Files Owner</code> to <code>CustomView</code> and the connect the IBOutlet <code>view</code> to the main view in the <code>.Xib</code>.</p>

<p>In my ViewController I did this to add the <code>CustomView</code> to it:</p>

<pre><code>let customView = CustomView()
customView.presentInView(superView: self.view)
</code></pre>

<p>When I add a <code>UIView</code> in Interface Builder it should work just as it does when I do it programmatically.</p>