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
Simen Anthonsen
1,097 PointsWhen to use NSMutuableArray?
In my app, I plan to have around 3000 CKRecords which I will retrieve and place all of them in an array. I will later have to loop through that array several times. Is this a good time to use NSMutuableArray?
2 Answers
Jason Anders
Treehouse Moderator 145,863 PointsHey Simen,
In my opinion, unless you are 100% sure the array will never have to be modified in the future, use NSMutableArray. There are many threads with others' opinions on Stack Overflow, but it will essentially come down to your decision based on what's best for your code.
Simen Anthonsen
1,097 PointsThanks for answering, Jason. I´m not sure how to use it tough. I manage to put all of the records in the NSMutuableArray, but I don´t know how i can use their attributes later on. Say I´m retrieving movie objects and adds them to the array named movies. I later on want be able to, do for example this.
label.text = movies[0].objectForKey("Title") as? String
But if i do that i get the error, ambitious use of object for key...