<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/TaskGroup/Iterator/next(isolation:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:ScG8IteratorV4next9isolationxSgScA_pSgYi_tYaF"
  },
  "title" : "next(isolation:)"
}
-->

# next(isolation:)

Advances to and returns the result of the next child task.

```
mutating func next(isolation actor: isolated (any Actor)?) async -> TaskGroup<ChildTaskResult>.Iterator.Element?
```

## Return Value

The value returned by the next child task that completes,
or `nil` if there are no remaining child tasks,

## Discussion

The elements returned from this method
appear in the order that the tasks *completed*,
not in the order that those tasks were added to the task group.
After this method returns `nil`,
this iterator is guaranteed to never produce more values.

For more information about the iteration order and semantics,
see `TaskGroup.next()`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)