Reputation: 9329
Here are two ways to make a NSString
.
NSString *sBody = [NSString stringWithString:@"Hello"]
versus
NSString *sBody = @"Hello"
Most of the time, I see it the first way. But is it also "clean" to use the second, or is it better to not use it?
Thanks and have a nice day!
Upvotes: 2
Views: 169
Reputation: 558
It's the same, the first way you're helping the compiler but it already does a great job optimizing string vars.
Upvotes: 2
Reputation: 16636
They are equivalent. It's less code to use the literal (the second example), so I would just use that.
Upvotes: 4