<!--
{
  "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/CheckedContinuation/init(continuation:function:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:ScC12continuation8functionScCyxq_GSccyxq_G_SStcfc"
  },
  "title" : "init(continuation:function:)"
}
-->

# init(continuation:function:)

Creates a checked continuation from an unsafe continuation.

```
init(continuation: UnsafeContinuation<T, E>, function: String = #function)
```

## Parameters

`continuation`

An instance of `UnsafeContinuation`
that hasn’t yet been resumed.
After passing the unsafe continuation to this initializer,
don’t use it outside of this object.

`function`

A string identifying the declaration that is the notional
source for the continuation, used to identify the continuation in
runtime diagnostics related to misuse of this continuation.

## Discussion

Instead of calling this initializer,
most code calls the `withCheckedContinuation(function:_:)` or
`withCheckedThrowingContinuation(function:_:)` function instead.
You only need to initialize
your own `CheckedContinuation<T, E>` if you already have an
`UnsafeContinuation` you want to impose checking on.

---

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)