My name is Jake Marsh.
I'm a developer, designer, and writer.

Subscribed via Push Notifications. You can also subscribe via RSS or Twitter.

Subscribe via RSS or Twitter.

Subscribe via Push Notifications, RSS or Twitter.

▸ Literal Syntax for NSArray, NSDictionary & NSNumber

I can't tell you how long I've been waiting for this.

As Joris points out, it appears that Apple has committed the necessary changes to the LLVM project to allow LLVM to fully support the latest Objective-C language features.

Apple committed a new patch to the llvm project adding support for new Objective-C literal syntax for NSArray, NSDictionary and NSNumber. These have previously been documented in the Mountain Lion Xcode release notes but that was still under NDA. Now that these features have been committed to llvm I guess we’re allowed to speak about it.

...and since LLVM isn't under NDA like most of the "developer preview" stuff, this means we can all finally discuss this stuff on our blogs!

Here's a (small) taste of the great new syntax:


NSNumber *someNumber = @31;  // [NSNumber numberWithInt:31] 


//NSArray *doctors = [NSArray arrayWithObjects:@"Matt Smith", @"David Tennant", @"Tom Baker", nil];
NSArray *doctors = @[@"Matt Smith", @"David Tennant", @"Tom Baker"];


NSDictionary *tweet = @{
  @"text": @"Hi! I'm a tweet!",
  @"user": @"jakemarsh",
  @"timestamp": @1331664532
Vote on Hacker News