Iterator

    A type that provides an iteration interface over the results of tasks added to the group.

    iOS
    13.0+
    macOS
    10.15+
    tvOS
    13.0+
    watchOS
    6.0+
    struct Iterator

    The elements returned by this iterator appear in the order that the tasks completed, not in the order that those tasks were added to the task group.

    This iterator terminates after all tasks have completed. After iterating over the results of each task, it’s valid to make a new iterator for the task group, which you can use to iterate over the results of new tasks you add to the group. For example:

    group.addTask { 1 }
    for await r in group { print(r) }
    
    // Add a new child task and iterate again.
    group.addTask { 2 }
    for await r in group { print(r) }

    Citizens in _Concurrency

    Conformances

    Members