Reputation: 1229
I was wondering why can we declare NSString like this:
NSString *strongName = @"Kuba";
But we cannot declare NSMutableString the same way:
NSMutableString *strongName2 = @"Kuba";
Instead, I have to use older(?) approach:
NSMutableString *strongName3 = [NSMutableString stringWithFormat:@"Kuba"];
Thank you for any meaningful insight :))
Upvotes: 1
Views: 58
Reputation: 4051
NSString *myString = @"Kuba"
is a shorthand for NSString
alone. If you need a NSMutableString
, you could get a mutable copy from it: NSMutableString *myMutableString = [@"Kuba" mutableCopy]
.
Upvotes: 2