0

I have an @IBDesignable class with the following property:

@IBInspectable var isSelected = false {
    didSet{
        self.delegate?.toggleViewToggled(selected: isSelected, object: self)
        self.setNeedsDisplay()
    }
}

But in Interface Builder, there's not the usual dropdown menu to let me edit the property. What's wrong with the code?

Rogare
  • 3,234
  • 3
  • 27
  • 50

1 Answers1

0

The variable type needs to be explicit for IBInspectable properties. So, the code should read:

@IBInspectable var isSelected:Bool = false { 
    didSet{
        self.delegate?.toggleViewToggled(selected: isSelected, object: self)
        self.setNeedsDisplay()
    }
}
Rogare
  • 3,234
  • 3
  • 27
  • 50