Xcode 6 @IBInspectable: Initialize Initial Value?

When you add @IBInspectable properties, they are initialized essentially ... nothing.

enter image description here

Is there a way for these default properties to be something? Tell me red for track color, gray for background color and 10.0 for fill? I tried @IBInspectable public var padding: CGFloat = 10.0, but "10" is not reflected in IB.

+4
source share
1 answer

try this code:

override func prepareForInterfaceBuilder() {
    if self.padding == 0 {
        self.padding = 10}

}

source http://justabeech.com/ ?

+2
source

All Articles