<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/Continuation",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:12_Concurrency12ContinuationV"
  },
  "title" : "Continuation"
}
-->

# Continuation

A mechanism to interface between synchronous and asynchronous code,
which enforces that the continuation is resumed exactly once.

```
@frozen struct Continuation<Success, Failure> where Failure : Error, Success : ~Copyable
```

## Overview

Unlike `CheckedContinuation`, which detects misuse at runtime,
`Continuation` uses non-copyable semantics to enforce correct usage.

The continuation must only ever be resumed **exactly-once**.
The compiler will prevent attempts from resuming the continuation more than once.

If a `Continuation` is destroyed without being
resumed, the program traps with a diagnostic message indicating where
the continuation was created. Because it is noncopyable, the compiler
prevents accidental copies, and the `consuming` resume methods ensure
the continuation can only be used once.

To create a continuation
call [`withContinuation(of:throwing:_:)`](/documentation/Swift/withContinuation(of:throwing:_:)).

To resume the task, suspended on a continuation, call [`resume(returning:)`](/documentation/Swift/Continuation/resume(returning:)-5fa8w),
[`resume(throwing:)`](/documentation/Swift/Continuation/resume(throwing:)), [`resume(with:)`](/documentation/Swift/Continuation/resume(with:)), or [`resume()`](/documentation/Swift/Continuation/resume()).

> SeeAlso: ``doc://com.apple.Swift/documentation/Swift/CheckedContinuation``

## Topics

### Instance Methods

[`func resume()`](/documentation/Swift/Continuation/resume())

Resume the task awaiting the continuation by having it return
from its suspension point

[`func resume(returning: consuming sending Success)`](/documentation/Swift/Continuation/resume(returning:)-5fa8w)

Resume the task awaiting the continuation by having it return
from its suspension point

[`func resume(returning: consuming sending Success)`](/documentation/Swift/Continuation/resume(returning:)-8uw9b)

Resume the task awaiting the continuation by having it return
from its suspension point

[`func resume(throwing: Failure)`](/documentation/Swift/Continuation/resume(throwing:))

Resume the task awaiting the continuation by having it throw an error
from its suspension point

[`func resume(with: consuming sending Result<Success, Failure>)`](/documentation/Swift/Continuation/resume(with:))

Resume the task awaiting the continuation by having it either
return or throw an error based on the state of the given
`Result` value

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

---

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)