Object subscripting in Objective-C

Wed, Jun 5

Thanks to Apple LLVM Compiler 4+, you can now use object scripting:

NSArray *array = @[@"fu", @"bar"];

Here is the traditional means to access an array element:

NSLog(@"index[1]: %@", [array objectAtIndex:1]);

With object scripting, you can now do this:

NSLog(@"index[1]: %@", array[1]);