Absolutely! Just remember that it #defineis a simple substitute for text before compilation: you want it to kClassbe UIColor, and not [UIColor class], just like you will never write @interface [UIColor class] (MyCategory).
Finally:
#if TARGET_OS_IPHONE
#define kClass UIColor
#import <UIKit/UIKit.h>
#elif TARGET_OS_MAC
#define kClass NSColor
#import <AppKit/AppKit.h>
#endif
@interface kClass (MyCategory)
source
share