Xcode6: IBDesignable and IBInspectable with Objective-C

Objective CSwiftXcode6

Objective C Problem Overview


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?

Objective C Solutions


Solution 1 - Objective C

Code example:

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

Solution 2 - Objective C

The equivalents are IB_DESIGNABLE and IBInspectable—see the documentation for Objective C examples.

Also, this year's WWDC video "What's New in Interface Builder" has its examples in Swift, but the presenter also mentions the Objective C equivalents in passing.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmxbView Question on Stackoverflow
Solution 1 - Objective CAdam WaiteView Answer on Stackoverflow
Solution 2 - Objective CMatt GibsonView Answer on Stackoverflow