How for in loop works internally - Objective C - Foundation
I found this answer: https://stackoverflow.com/a/5163334/1364174 Which presents how for in loop is implemented. NSFastEnumerationState __enumState = {0}; id __objects[MAX_STACKBUFF_SIZE]; NSUInteger __count; while ((__count = [myArray countByEnumeratingWithState:&__enumState objects:__objects count:MAX_STACKBUFF_SIZE]) > 0) { for (NSUInteger i = 0; i < __count; i++) { id obj = __objects[i]; [obj doSomething]; } } The problem is that, I found it wrong. First of all, when you have Automatic Reference Counting (ARC) turned on, you got an error Sending '__strong id *' to parameter of type '_