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;
  4. for (item in originalArrayOfItems) {
  5. if ([item shouldBeDiscarded])
  6. [discardedItems addObject:item];
  7. }
  9. [originalArrayOfItems removeObjectsInArray:discardedItems];

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.