Submits a single block to the dispatch queue and causes the block to be executed the specified number of times.
- iOS 8.0+
- macOS 10.10+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
- Xcode 8.0+
The number of times to execute the block. Higher iteration values give the system the ability to balance more efficiently across multiple cores.
The block to execute in parallel. This block has no return value and takes the following parameter:
The current iteration index.
This method implements an efficient parallel for-loop. The dispatch queue executes the submitted block the specified number of times and waits for all iterations to complete before returning. If the target queue is a concurrent queue, the blocks run in parallel and must therefore be reentrant-safe.