I've been using enumerateObjectsUsingBlock: a lot lately for my fast-enumeration needs, and I'm having a hard time understanding the usage of BOOL *stop in the enumeration block.
The NSArray class reference states
stop: A reference to a Boolean value. The block can set the value toYESto stop further processing of the array. Thestopargument is an out-only argument. You should only ever set this Boolean toYESwithin the Block.
So then of course I can add the following in my block to stop the enumeration:
if (idx == [myArray indexOfObject:[myArray lastObject]]) {
*stop = YES;
}
From what I've been able to tell, not explicitly setting *stop to YES doesn't have any negative side effects. The enumeration seems to automatically stop itself at the end of the array. So is using *stop really necessary in a block?