Yes, it is. It's a new feature of modern objective-C.
You can create new arrays with the literal @
, like in the example you have. This works well not only for NSArrays
, but for NSNumbers
and NSDictionaries
too, like in:
NSNumber *fortyTwo = @42; // equivalent to [NSNumber numberWithInt:42]
NSDictionary *dictionary = @{
@"name" : NSUserName(),
@"date" : [NSDate date],
@"processInfo" : [NSProcessInfo processInfo] //dictionary with 3 keys and 3 objects
};
NSArray *array = @[@"a", @"b", @"c"]; //array with 3 objects
It nice for accessing the elements too, like this:
NSString *test = array[0]; //this gives you the string @"a"
NSDate *date = dictionary[@"date"]; //this access the object with the key @"date" in the dictionary
You can have more informations here: http://clang.llvm.org/docs/ObjectiveCLiterals.html