Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
Just had a quick question.

I have a method in a Class that sorts an array, gets information and then returns an NSArray with this code.
Code:
NSMutableArray *itemsFromSkill = [BoilerPlateCode returnItemsForSkill:itemStringLabel withItemList:skillsListDict];

I discovered that I need to add object to the new array called "itemsFromSkill" so I changed it to an NSMutableArray. Should I go back to the method that sorts and returns an NSArray and have it return an NSMutableArray, or does it matter?

I remember a while back reading something about this and this is not the correct way but I can't remember? I think I would need to convert an NSArray to an NSMutableArray with a method like makeMutableCopy or something.

It' not a big deal. I was just wondering.

Thanks.
 

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
OK That clears it up. So there is a correct way of doing it. I went a head and convert my method to return an NSMutableArray.

Thanks.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.