Gold Challenge Q: Adding items to Array in a Container


Newbie Q. I hit a roadblock. From Main, I need to add items to an array that is in a container. The container and the array are instantiated.

If your “container” is instantiated as “myAppleStuff” and the array in the container is “containerArray”, then what would be the appropriate Objective C way of putting an item, let’s say “iPad” into the array in the container? I think of it as:

And, guess how well that works. Right, not so well.

Speak to me, oh gods of Objective-C!


Maybe I answered my own question. I wrote a container method to do it:

-(void) putAnItemInArray: (id)item { [containerArray addObject:item]; }

This works, but is there a more direct way?