If I know what type of objects I am storying in my array, is it better to type it as such in the block enumeration or no?
Instead of:
[myClassArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { }];
Use this:
[myClassArray enumerateObjectsUsingBlock:^(MyClass *obj, NSUInteger idx, BOOL *stop) { }];
As long as you aren't reassigning the array, you should be fine. Obviously it's better practice to set up a check to make sure if there is any doubt. The
enumerateObjectsUsingBlock
functions the same as afor(MyClass *obj in myClassArray)
so you would only use the enumerate method if you wanted to take advantage of it's extra features. If you would describe the object as MyClass in the for loop circumstance, you might as well in the enumeration.