4

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

enter image description here

Is there a way to have these properties default to something? Say a red color for the track color, grey color for the background color and 10.0 for padding? I've tried @IBInspectable public var padding: CGFloat = 10.0 but the "10" does not get reflected in IB.

RyJ
  • 3,995
  • 6
  • 34
  • 54

1 Answers1

2

try this code:

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

}

source http://justabeech.com/?

jamil
  • 352
  • 1
  • 3
  • 12