Is there a literal syntax for mutable collections? Is there a literal syntax for mutable collections? objective-c objective-c

Is there a literal syntax for mutable collections?


There isn't a built in way, but I just usually use mutableCopy like this:

NSMutableArray *array = [@[ @"1", @"2", @"3" ] mutableCopy];


No. Just as how there isn't a syntax for creating an NSMutableString either. Mutable objects are not particularly suited to literal values.


But, is there a literal syntax for creating an NSMutableArray or an NSMutableDictionary?

No. Best alternative:

[@[ @"foo", @"bar"] mutableCopy]