Another gotcha to look our for are things in asset catalogues such as colours. i.e.
var mycol = UIColor(named: "mycol")!
will crash because the colour can't be found in whatever context the xib is running. Do this instead:
var mycol = UIColor(named: "mycol", in: Bundle(for: MyView.self), compatibleWith: nil)!
Topic:
Programming Languages
SubTopic:
Swift
Tags: