When I write my own UIButton-extended class and make it @IBDesignable, I receive two errors in Interface Builder, namely:
For me, it was not using #if !TARGET_INTERFACE_BUILDER that got me. Basically I had some code that would result in accessing a path in my Bundle...
Bundle.main.path(forResource: "Foo", ofType: "plist")
The problem is that when running in IB (and not in your app), Bundle.main isn't your app...
(lldb) po Bundle.main
NSBundle (loaded)
So the answer to this is simply to review your @IBDesignable UIView code carefully and use #if !TARGET_INTERFACE_BUILDER for anything (in my case calls to CoreLocation for example) that doesn't make sense when running at design time.
This is what you see when using the Editor -> Debug Selected View while selecting your @IBDesignable UIView in your storyboard:
In my case, as you can see initXXXX was doing an assert, which was crashing at design time, because it was looking for a value in file in my Bundle — which is Xcode, at design time.