Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@IBInspectable with enum?

I'd like to create @IBInspectable element as you see at the picture below :

enter image description here

my idea is to use something like enum as type for @IBInspectable, but it looks like it's not the case, any ideas how to implement element like this ?

EDIT:

It looks like @IBInspectable supports only these types :

  • Int
  • CGFloat
  • Double
  • String
  • Bool
  • CGPoint
  • CGSize
  • CGRect
  • UIColor
  • UIImage

bummer

like image 324
ignotusverum Avatar asked Feb 26 '15 18:02

ignotusverum


1 Answers

That's not possible (for now). You can only use those types that you see in User Defined Runtime Attributes section.

From Apple's doc:

You can attach the IBInspectable attribute to any property in a class declaration, class extension, or category for any type that’s supported by the Interface Builder defined runtime attributes: boolean, integer or floating point number, string, localized string, rectangle, point, size, color, range, and nil.

like image 88
yusuke024 Avatar answered Oct 11 '22 00:10

yusuke024