Reputation: 10769
Trying to cast the return of objectAtIndex.
(MyClass *)[myArray objectAtIndex:1].name;
Can you cast inline like this in Objective-C?
Upvotes: 4
Views: 2990
Reputation: 727047
You can avoid casting altogether by replacing the dot-syntax of accessing properties with the regular method invocation syntax:
[[myArray objectAtIndex:1] name]
Upvotes: 2