Created
August 20, 2012 14:18
-
-
Save oleganza/3404669 to your computer and use it in GitHub Desktop.
Modern Objective-C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 2011: | |
[container setObject:value forKey:[NSString stringWithFormat:@"%d", number]]; | |
// 2012: | |
container[@(number).stringValue] = value; |
It is a smart shortcut in this case for [NSNumber numberWithInt:number]...
But bad think about this is that if you use any of these new features, you will not compile your project on older version of Xcode :-/...
you don't have to write ".stringValue", just "@(number)" is enough
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What does
@(number)
mean?