Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

How to manage an Array of NSMutableArrays from same data source

This seems to be a basic problem that somehow got me stuck on the way to approach it. I'm trying to create 3 NSMutableArrays with a loop of 3 iterations. The NSMutableArrays contain the objects I need to work on. While the NSMutableArrays come from the same data source, their content differ in terms of data organization (or sequence) at each loop. The ideal would be to have an Array containing the 3 different NSMutableArrays. I tried therefore to create an helper to return a NSMutableArray at each loop. However, even if I assign the newly returned NSMutableArray to a specific variable (e.g. ArrayFirstLoop, ArraySecondLoop, etc.) through a switch statement, at each loop the previous Arrays are updated with the newly created Array from the latest loop (and this is not surprising given the pointer-nature of Arrays). What is then the right approach to what I am trying to do here? Thank you in advance.