|
|
|
|
|
by dennis_vartan
4640 days ago
|
|
Like! Much as I love ObjC, reducing verbosity via better syntax can go a long way to making code more readable. For example, I ended up putting together some defines like this after building a bunch of UI programmatically. #define RGB(r, g, b) [NSColor colorWithDeviceRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]
#define RGBA(r, g, b, a) [NSColor colorWithDeviceRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
RGB(255, 104, 0) may be a bit too C-ish, but it sure beats the long form. Have similar GRAY(x) and GRAYA(x) defines for producing grayscale colors.Definitely interested to see more projects along these lines. |
|