I have a .xib
file called ContentView
that I want to use as the view for a class called ContentView
, however I cannot seem to load it.
class ContentView: UIView {
override init() {
super.init(frame: CGRect(x: 0, y: 0, width: 500, height: 500))
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
fatalError("init(coder:) has not been implemented")
}
}
I'm aware that you can load a xib
using the following method but this gives a error when I do so:
var contentViewXib: NSArray = NSBundle.mainBundle().loadNibNamed("ContentView", owner: nil, options: nil)
I have also set the xibs
files owner to ContentView
and set its Custom Class in interface builder to the class I want to use it with.
Any help is appreciated. Thanks