Search code examples
objective-ccocoansarrayobjective-c-literals

What is the meaning of @[object1, object2]?


Possible Duplicate:
What kind of object does @[obj1, obj2] create?

Looking at the Master-Detail Template in Xcode, in the App Delegate the SplitViewController's view controllers are set like so:

self.splitViewController.viewControllers = @[masterNavigationController, detailNavigationController];

I don't know what the purpose of the @ sign is before the square brackets. Is this just how NSArrays are made when not using [NSArray arrayWithObjects:]?


Solution

  • It's a new syntax feature. It's syntactic sugar for creating an array (NSArray) with the given objects.