Casting the return of objectAtIndex on NSArray

casting, ios, nsarray, objective-c

Solution

Yes you can:

((MyClass *)[myArray objectAtIndex:1]).name

Problem

Trying to cast the return of objectAtIndex. ``` (MyClass *)[myArray objectAtIndex:1].name; ``` Can you cast inline like this in Objective-C?

Original source