In the process of looking at the source code, I saw that some methods used
enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop);
Then I did some operations in this method. Add the value to the array. What is the benefit of writing this way? What is its specific effect? What is the difference between it and the for loop and the for in loop?
数组查询,小量的查询效率优势不是很明显,建议用forin。但是大量的数组建议用枚举
再一个是遍历字典建议用枚举,这样可以一次拿取key和value
遍历数组的时候可以对数组进行操作。
用forin的话,遍历数组的时候对数组进行操作容易崩溃