5 ms·
Somewhat unrelated ... I wish Apple would add local type inference to Objective-C, perhaps using the existing id type or some keyword like var in C#. It would
by wsc981 13y ago
Somewhat unrelated ...
I wish Apple would add local type inference to Objective-C, perhaps using the existing id type or some keyword like var in C#. It would make the code so much more quicker to write, less verbose, a bit easier to change.
I mean reading and writing something like:
var color = [UIColor green];
var viewController = [[MyViewController alloc] initWithBackgroundColor:color];
Is so much more pleasant as:
UIColor *color = [UIColor green];
MyViewController *viewController = [[MyViewController alloc] initWithBackgroundColor:color];
- mpweiher 13y agoYou could just write: id color = [UIColor green]; id viewController = [[MyViewController alloc] initWithBackgroundColor:color]; The UIColor* is largely there for your benefit, for the compiler it makes hardly a difference (pre ARC). If you don't find it a benefit, just leave it out.