creating objects within a block
-
28-09-2019 - |
Question
[myArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[[myTreeNode mutableChildNodes] addObject:[NSTreeNode treeNodeWithRepresentedObject:obj]];
//myTreeNode is an NSTreeNode
}];
Is it ok to create objects from within a block?
Solution
Yes. It's basically OK to do anything in a block that you might do in a normal function.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow