completeWithTask(_:)

Complete a future with the result (or error) of the async function body.

AsyncAwaitSupport.swift:73
iOS
13+
macOS
10.15+
tvOS
13+
watchOS
6+
@discardableResult @preconcurrency func completeWithTask(_ body: @escaping () async throws -> Value) -> Task<Void, Never> where Value : Sendable

Parameters

body

The async function to run.

Returns

A Task which was created to await the body.

This function can be used to bridge the async world into an EventLoopPromise.