I found a bug where if a view inherits from NibDesignable, layoutSubviews gets called with the original sizes from the nibs but not for subsequent resizes. I noticed it when I was making a circular image view and despite doing self.imageView.layer.cornerRadius = self.imageView.frame.size.width /2 in layoutSubviews, the image was rounded strangely, even when it had a 1:1 aspect ratio using autolayout.
My fix was simply to add self.layoutIfNeeded to awakeFromNib but I suspect the issue goes deeper than that.
I found a bug where if a view inherits from
NibDesignable,layoutSubviewsgets called with the original sizes from the nibs but not for subsequent resizes. I noticed it when I was making a circular image view and despite doingself.imageView.layer.cornerRadius = self.imageView.frame.size.width /2inlayoutSubviews, the image was rounded strangely, even when it had a 1:1 aspect ratio using autolayout.My fix was simply to add
self.layoutIfNeededtoawakeFromNibbut I suspect the issue goes deeper than that.