2

I'm running XCode 8.1 and can not get my IBInspectable attributes appearing in Xcode. Any known issues with XCode 8.1 (swift 3) in this area? Or any issues with what I'm trying to do here?

Steps:

  • Create a simple IOS app
  • Created the following "customControl" class
  • In the app storyboard, drag a UIView onto the storyboard, and then change the class type of the "customControl"
  • I note XCode going through the "refresh views" stage, however no items get added to the "user defined runtime attributes" area?

Code:

import UIKit

@IBDesignable
class customControl : UIView {
    @IBInspectable
    var customAttribute: UIColor = UIColor.blue
}
Greg
  • 34,042
  • 79
  • 253
  • 454
  • 1
    oh...it's actually in the attributes inspector they turn up - I had seen an example where they seemed to be appearing in the identity inspector however perhaps this were manually added here... – Greg Nov 11 '16 at 04:15
  • `IBInspectable` attributes appears in Identity inspector to let you choose a value.Once you set,you can see in userDefinedAttributes the chose value as key value pair.So, `Inspectable` is just a user interface to the user defined runtime attributes – LC 웃 Nov 11 '16 at 05:04
  • this is addressed by the answer here: http://stackoverflow.com/questions/40560061/ibinspectable-with-cocoa-touch-framework-not-working-code-attached – Greg Nov 17 '16 at 01:23
  • You didnot mention about Xib in this question – LC 웃 Nov 17 '16 at 01:46
  • I see what you mean - perhaps best to close this question as I tried to replicate in a more of a full application which was the basis of the other question – Greg Nov 17 '16 at 01:48

0 Answers0