NSArray objectAtIndex: shorthand [duplicate] NSArray objectAtIndex: shorthand [duplicate] ios ios

NSArray objectAtIndex: shorthand [duplicate]

This syntax was added in Clang 3.3 : Objective C Literals. Essentially, the compiler converts expressions of the type objCObj[idx] to the expression [objCObj objectAtIndexedSubscript:idx]. It also works for dictionaries, and you're free to adopt it for your own objects.

As such, you're perfectly safe using it, assuming you'll be using a modern version of Objective C and suitably updated Objective C compiler (i.e. Clang).

this is a new feature of objective-c and avaiable since xCode 4.5

its safe to use this syntax, you can even give your own classes support for this.

Ya, it's safe to use these syntax.

Those syntax are part of Modern Objective-C.

You can check this article for more options: ObjectiveCLiterals