NSMutableArray Loop


/ Published in: Objective C
Save to your folder(s)

Just a simple loop around an NSMutableArray, but also removing an item if need be.


Copy this code and paste it in your HTML
  1. NSMutableArray *discardedItems = [NSMutableArray array];
  2. SomeObjectClass *item;
  3.  
  4. for (item in originalArrayOfItems) {
  5. if ([item shouldBeDiscarded])
  6. [discardedItems addObject:item];
  7. }
  8.  
  9. [originalArrayOfItems removeObjectsInArray:discardedItems];

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.