Created
December 5, 2012 22:14
-
-
Save supermarin/4219990 to your computer and use it in GitHub Desktop.
NSString literals
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
| // Currently, there's too much effort for printing strings with arguments. | |
| // The current way | |
| NSString *sentence = [NSString stringWithFormat:@"This is a text with argument %@", argument]; | |
| // Possible literal | |
| NSString *sentence = @("This is a text with argument %@", argument); | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@umairsd correct, that's the original proposal :)
@dilejmon, I haven't; wanted to see what others are saying. I don't know either what's the best place to ask this question :)
In the meantime, @neilco has built a macro
_(@"text: %@", argument), but I find it a bit confusing for newcomers.We ended up with
NSStringWithFormat(@"text: %@", argument), you can find it in ObjectiveSugar