mbogh / NibDesignable

Elegant way of enabling IBDesignable on your nib-based views
MIT License
342 stars 74 forks source link

Xib is not loaded #4

Closed cyril94440 closed 9 years ago

cyril94440 commented 9 years ago

Hi,

thank you for your awesome view.

I did managed to make your library working once but is is not working anymore.

I set the file owner to my custom view I let the main UIView as an UIView I named the xib to the same name as the class.

The only thing I changed is that I used custom live rendering view inside my xib (Those views don't use xib file so it renders well in the xib).

Do you have any idea ?

Here is the code :

import UIKit

class HeaderFicheClientView: NibDesignable {

@IBOutlet weak var nameCustomer: UILabel!

@IBInspectable internal var nameText:String = "Nathalie Beaudry"{
    willSet{
        nameCustomer.text = nameText
    }
}

@IBInspectable internal var borderColor:UIColor = UIColor.blackColor(){
    willSet{
        self.layer.borderColor = borderColor.CGColor
        self.layer.borderWidth = 1
    }
}

}

mbogh commented 9 years ago

I am not sure exactly what it is that is not working for you?

One issue could be that you use willSet and not didSet, so when you access borderColor and nameText they are not yet set.

mbogh commented 9 years ago

I'm closing this due to inactivity.