Concurrency
import _Concurrency
import _Concurrency
func swift_deletedAsyncMethodError() async
func withCheckedContinuation<T>(function: String, (CheckedContinuation<T, Never>) -> Void) async -> T
Suspends the current task, then calls the given closure with a checked continuation for the current task.
func withCheckedThrowingContinuation<T>(function: String, (CheckedContinuation<T, Error>) -> Void) async throws -> T
Suspends the current task, then calls the given closure with a checked throwing continuation for the current task.
func withTaskCancellationHandler<T>(operation: () async throws -> T, onCancel: () -> Void) async rethrows -> T
Execute an operation with a cancellation handler that’s immediately invoked if the current task is canceled.
func withTaskGroup<ChildTaskResult, GroupResult>(of: ChildTaskResult.Type, returning: GroupResult.Type, body: (inout TaskGroup<ChildTaskResult>) async -> GroupResult) async -> GroupResult
Starts a new scope that can contain a dynamic number of child tasks.
func withThrowingTaskGroup<ChildTaskResult, GroupResult>(of: ChildTaskResult.Type, returning: GroupResult.Type, body: (inout ThrowingTaskGroup<ChildTaskResult, Error>) async throws -> GroupResult) async rethrows -> GroupResult
Starts a new scope that can contain a dynamic number of throwing child tasks.
func withUnsafeContinuation<T>((UnsafeContinuation<T, Never>) -> Void) async -> T
Suspends the current task, then calls the given closure with an unsafe continuation for the current task.
func withUnsafeCurrentTask<T>(body: (UnsafeCurrentTask?) throws -> T) rethrows -> T
Calls a closure with an unsafe reference to the current task.
func withUnsafeThrowingContinuation<T>((UnsafeContinuation<T, Error>) -> Void) async throws -> T
Suspends the current task, then calls the given closure with an unsafe throwing continuation for the current task.
struct AsyncCompactMapSequence
An asynchronous sequence that maps a given closure over the asynchronous sequence’s elements, omitting results that don’t return a value.
struct AsyncDropFirstSequence
An asynchronous sequence which omits a specified number of elements from the base asynchronous sequence, then passes through all remaining elements.
struct AsyncDropWhileSequence
An asynchronous sequence which omits elements from the base sequence until a given closure returns false, after which it passes through all remaining elements.
struct AsyncFilterSequence
An asynchronous sequence that contains, in order, the elements of the base sequence that satisfy a given predicate.
struct AsyncFlatMapSequence
An asynchronous sequence that concatenates the results of calling a given transformation with each element of this sequence.
struct AsyncMapSequence
An asynchronous sequence that maps the given closure over the asynchronous sequence’s elements.
struct AsyncPrefixSequence
An asynchronous sequence, up to a specified maximum length, containing the initial elements of a base asynchronous sequence.
struct AsyncPrefixWhileSequence
An asynchronous sequence, containing the initial, consecutive elements of the base sequence that satisfy a given predicate.
struct AsyncStream
An asynchronous sequence generated from a closure that calls a continuation to produce new elements.
struct AsyncThrowingCompactMapSequence
An asynchronous sequence that maps an error-throwing closure over the base sequence’s elements, omitting results that don’t return a value.
struct AsyncThrowingDropWhileSequence
An asynchronous sequence which omits elements from the base sequence until a given error-throwing closure returns false, after which it passes through all remaining elements.
struct AsyncThrowingFilterSequence
An asynchronous sequence that contains, in order, the elements of the base sequence that satisfy the given error-throwing predicate.
struct AsyncThrowingFlatMapSequence
An asynchronous sequence that concatenates the results of calling a given error-throwing transformation with each element of this sequence.
struct AsyncThrowingMapSequence
An asynchronous sequence that maps the given error-throwing closure over the asynchronous sequence’s elements.
struct AsyncThrowingPrefixWhileSequence
An asynchronous sequence, containing the initial, consecutive elements of the base sequence that satisfy the given error-throwing predicate.
struct AsyncThrowingStream
An asynchronous sequence generated from an error-throwing closure that calls a continuation to produce new elements.
struct CancellationError
An error that indicates a task was canceled.
struct CheckedContinuation
A mechanism to interface between synchronous and asynchronous code, logging correctness violations.
struct ContinuousClock
A clock that measures time that always increments but does not stop incrementing while the system is asleep.
struct SuspendingClock
A clock that measures time that always increments but stops incrementing while the system is asleep.
struct Task
A unit of asynchronous work.
struct TaskGroup
A group that contains dynamically created child tasks.
struct TaskPriority
The priority of a task.
struct ThrowingTaskGroup
A group that contains throwing, dynamically created child tasks.
struct UnownedJob
A unit of scheduleable work.
struct UnownedSerialExecutor
An unowned reference to a serial executor (a SerialExecutor
value).
struct UnsafeContinuation
A mechanism to interface between synchronous and asynchronous code, without correctness checking.
struct UnsafeCurrentTask
An unsafe reference to the current task.
class MainActor
A singleton actor whose executor is equivalent to the main dispatch queue.
class TaskLocal
Property wrapper that defines a task-local value key.
protocol Actor
Common protocol to which all actors conform.
protocol AnyActor
Common marker protocol providing a shared “base” for both (local) Actor
and (potentially remote) DistributedActor
types.
protocol AsyncIteratorProtocol
A type that asynchronously supplies the values of a sequence one at a time.
protocol AsyncSequence
A type that provides asynchronous, sequential, iterated access to its elements.
protocol Clock
A mechanism in which to measure time, and delay work until a given point in time.
protocol Executor
A service that can execute jobs.
protocol GlobalActor
A type that represents a globally-unique actor that can be used to isolate various declarations anywhere in the program.
protocol SerialExecutor
A service that executes jobs.
func async<T>(priority: TaskPriority?, operation: () async -> T) -> Task<T, Never>
func async<T>(priority: TaskPriority?, operation: () async throws -> T) -> Task<T, Error>
func asyncDetached<T>(priority: TaskPriority?, operation: () async -> T) -> Task<T, Never>
func asyncDetached<T>(priority: TaskPriority?, operation: () async throws -> T) -> Task<T, Error>
func detach<T>(priority: TaskPriority?, operation: () async -> T) -> Task<T, Never>
func detach<T>(priority: TaskPriority?, operation: () async throws -> T) -> Task<T, Error>
func withTaskCancellationHandler<T>(handler: () -> Void, operation: () async throws -> T) async rethrows -> T