When I include my custom IBDesignable view in a storyboard or another nib, the agent crashes and throws an exception because it can't load the nib.
error: IB Designables: Failed to update auto layout status: The agent raised a "NSInternalInconsistencyException" exception: Could not load NIB in bundle: 'NSBundle (loaded)' with name 'StripyView'
Here's the code I use to load the nib:
override init(frame: CGRect) {
super.init(frame: frame)
loadContentViewFromNib()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
loadContentViewFromNib()
}
func loadContentViewFromNib() {
let nib = UINib(nibName: String(StripyView), bundle: nil)
let views = nib.instantiateWithOwner(self, options: nil)
if let view = views.last as? UIView {
view.frame = bounds
view.autoresizingMask = [UIViewAutoresizing.FlexibleWidth, UIViewAutoresizing.FlexibleHeight]
addSubview(view)
}
}
The view loads from the nib correctly when I run in the simulator, why won't it display in Interface Builder?