0

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

sneps
  • 387
  • 4
  • 13
  • Are you using xcode 8.0 ? Than check this link http://stackoverflow.com/questions/39492765/xcode-8-storyboard-warnings-for-navigation-bar-width – tejas Feb 02 '17 at 13:47
  • I use Xcode 8.2.1 and the problem is not solved – sneps Feb 02 '17 at 14:05

1 Answers1

1

Try: Editor > Automatically Refresh Views > Uncheck. This should stop the constant rebuilding, but yes, it appears like just another annoying Xcode bug.