Xcode6: IBDesignable and IBInspectable with Objective-C

mxb picture mxb · Jun 28, 2014 · Viewed 50.5k times · Source

I have an Objective-C UI component that I'd like to make inspectable in Interface Builder with Xcode 6. Swift has the @IBDesignable and @IBInspectable declaration attributes. Are they available also in Objective-C? How are they used?

Answer

Adam Waite picture Adam Waite · Dec 9, 2014

Code example:

#import <UIKit/UIKit.h>
IB_DESIGNABLE
@interface LOLView : UIView
@property (nonatomic) IBInspectable UIColor *someColor; 
@end