I am trying to create a subclass of NSObject that will have many methods that return colors, so I want to return UIColor if I create for iOS or NSColor if I create for OS X.
This is a kind of pseudo-code of expected behavior:
#define COLOR #if TARGET_OS_IPHONE UIColor #elif TARGET_OS_MAC NSColor #endif + (COLOR *)makeMeColorful;
Is it possible to do something like this instead of doing 2 methods for each of my object methods (one for iOS and the other for OS X)?
c-preprocessor objective-c cocoa uicolor nscolor
Pedro vieira
source share