1

According to Apple docs, we can add these types to IBInspectable attribute.

Render and inspect your custom views

You can add the IBInspectable attribute to any property in a class declaration, class extension, or category of type: boolean, integer or floating point number, string, localised string, rectangle, point, size, colour, range, and nil.

I'm able to add all types except range. can somebody explain how to add range to IBInspectable attribute?

Community
  • 1
  • 1
Sahil
  • 9,096
  • 3
  • 25
  • 29
  • Check this answer if you needful http://stackoverflow.com/questions/30831609/how-to-set-a-max-limit-for-an-ibinspectable-int – Ronak Mar 29 '17 at 07:07
  • Already check this but doesn't help. if i take IBInspectable type UInt it then min value is 0 in attributes inspector( don't go below 0). i want something like that. – Sahil Mar 29 '17 at 07:12
  • 1
    I also wonder what an inspectable attribute of type "nil" should be ... – Martin R Mar 29 '17 at 08:50
  • @MartinR i guess nil refer to the optional types. – Sahil Mar 29 '17 at 08:54
  • In http://nshipster.com/ibinspectable-ibdesignable/ it is said that you can use `NSRange`, but that does not work. I *assume* that the Apple documentation is just wrong. – Martin R Mar 29 '17 at 09:51
  • I believe it too Apple documentation may be wrong. and i raise this issue at `bugs.swift.org` https://bugs.swift.org/browse/SR-4412 – Sahil Mar 29 '17 at 10:01
  • That is for bugs in the Swift language, but your question is about Xcode (the view class can use Swift or Objective-C). You might have to file a bug report at https://bugreport.apple.com/. – Martin R Mar 29 '17 at 11:03
  • This seems like a bug i mean in storyboard identity inspector under user defined runtime attribute we are able to add Range attribute( also showing the Nil in the list). but when we add through IBInspectable it doesn't show user defined runtime attribute. all other are showing. – Sahil Mar 29 '17 at 11:06

0 Answers0