I discovered today that there is a much less tedious way to create arrays and dictionaries on the fly:
NSArray *myArray = @[@"one", @"two", @"three"];
NSDictionary *myDict = @{@"key": @"value", @"key2": @"value2"};
Is this a rather new addition to the objective-c language and what is the name of these constructs?
New as of Xcode 4.4. I’ve heard them referred to as collection literals.
EDIT to add:
You can also reference members of NSArray and NSDictionary as
array[1]anddictionary[@"key"]. The creation syntax is backwards compatible as it is fully expanded at build. The accessor syntax is not as it involves changes to the runtime.