i did make some custom views to be able to reuse them in different controller .xib files.
I do initialize them with:
var view: UIView!
var nibName = "MyCustomView"
override init(frame: CGRect) {
super.init(frame: frame)
initialize()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initialize()
}
private func initialize() {
self.backgroundColor = Theme.colorTransparent
let bundle = Bundle(for: type(of: self))
let nib = UINib(nibName: self.nibName, bundle: bundle)
self.view = nib.instantiate(withOwner: self, options: nil).first as! UIView
self.view.frame = self.bounds
self.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
addSubview(self.view)
clearErrors()
}
But everytime i open a controller .xib file which contains at least one custom view, XCode starts recompiling. Sometimes also the position and size of all views (not only custom) are distorted. I then have to wait for the recompile to finish, before i can click the yellow triangles to fix the misplacements.
This behaviour is very annoying...
Can you help me to avoid the misplacements and the recompiling so that everything runs smooth and fast?
BTW: the custom views do work properly, it's just the waiting for the recompiling and the misplacements, which i was not able to fix
Thank you very much