<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/AsyncThrowingStream/Continuation/finish(throwing:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:Scs12ContinuationV6finish8throwingyq_Sgn_tF"
  },
  "title" : "finish(throwing:)"
}
-->

# finish(throwing:)

Resume the task awaiting the next iteration point by having it return
nil, which signifies the end of the iteration.

```
func finish(throwing error: Failure? = nil)
```

## Parameters

`error`

The error to throw, or `nil`, to finish normally.

## Discussion

Calling this function more than once has no effect. After calling
finish, the stream enters a terminal state and doesn’t produce any additional
elements.

---

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)