For most iteration blocks, signatures are defined sort of:
void(^)(id obj, BOOL* stop)
It looks better using return value for stopping flag.
BOOL(^)(id obj)
However I believe there is a strong reason made them to decide to use current form instead of more short and convenient form. Why do they use argument for stop flag?
Sure, it would work fine either way, but think of it this way: do you have to use the
continuestatement at the end of yourfororwhileloop? No, of course not because it happens automatically. If you want to stop looping though, you can just usebreak.Similarly with the block-based enumeration methods. You’re not required to return
YESto specify whether you want to continue enumeration or not because it will happen automatically. However, if you want to stop enumerating, you can simply set*stoptoYES.