title: Inheritable @IBInspectable var in Swift?
body: <p>Suppose <strong>I create an <code>@IBInspectable</code> variable in a base <code>@IBDesignable</code> class</strong>.</p>
  
  <p>Now, the attribute doesn't make the property inspectable in a derived class. That's clearly by design &mdash; you want to be able to create a derived class that sets base attributes according to its own logic and prohibits the user from touching them.</p>
  
  <p>However, suppose <strong>I want to make the same attributes inspectable in the derived class</strong>. The problem is, <code>@IBInspectable</code> is only used with variable definitions, so it seems to require me to redefine the variable, even though the definition has already been provided (that's where I miss Objective-C: you could change class interface without touching the implementation provided you knew what you were doing). </p>
  
  <p>This has the following drawback: you can't override a base stored variable, and you need to provide an explicit getter and setter. Therefore, the cleanest code I came up with is this:</p>
  
  <pre><code>// derived class
  @IBInspectable override var borderWidth: CGFloat {
  get {
      return super.borderWidth
  }
  set {
      super.borderWidth = newValue
  }
  }
  
  // base class
  @IBInspectable var borderWidth: CGFloat {
  set {
      layer.borderWidth = newValue
      // this can be a very complicated setter, of course
  }
  get {
      return layer.borderWidth
      // this can be a very complicated getter, of course
  }
  }
  </code></pre>
  
  <p><strong>Question: is there a shorthand syntax to do that?</strong></p>
  
  <p><em>(If not, and if other people like the idea, I'll probably file a radar for Apple's magicians.)</em></p>