Search code examples
iosswiftuiviewxcode-storyboard

Can't make User Defined Runtime Attributes work


I would really like to be able to use the "User Defined Runtime Attributes " from xcode Storyboard to build a nice pop up through a container view. Unfortunately, I can't make it works and can't figure out why !

I found many topics (eg: Is it possible to set UIView border properties from interface builder?) which deal about it but this doesn't work for me... !

Here is the attribute inspector of the containerView embed UIView (I also tried to implement into containerView UIView too with no success).

enter image description here

I added an extension to transform UIColor to CGColor as expected :

extension CALayer {
var borderUIColor: UIColor {
    set {
        self.borderColor = newValue.CGColor
    }

    get {
        return UIColor(CGColor: self.borderColor!)
    }
}

}

Does someone could think about something missing ?

Thank you very much in advance ;)


Solution

  • Instead of layer.borderColor, use layer.borderUIColor in your user defined runtime attributes. Just double click the key name and add UI.