Skip to content

feat: await Swift callbacks with the call operator - #1844

Merged
mrousavy merged 1 commit into
mrousavy/v1-swift6-language-modefrom
mrousavy/v1-async-callback-call-operator
Oct 20, 2026
Merged

mrousavy merged 1 commit into
mrousavy/v1-swift6-language-modefrom
mrousavy/v1-async-callback-call-operator

Conversation

@mrousavy

@mrousavy mrousavy commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Add an async throws call operator for Swift callbacks so let value = try await callback() awaits the result and propagates errors. It uses the same implementation and Sendable result constraint as the existing async callAsync() overload.

Includes a Void specialization so typed Void expressions also await the callback and propagate errors. Swift prefers the async overload inside async functions; use callAndForget() explicitly for fire-and-forget calls there. Synchronous call-operator behavior is unchanged.

Update existing standalone callers and the callback docs. Nitrogen regeneration produces no changes.

Validation: compiler probes cover 24 cases each in Swift 5 and Swift 6. Runtime checks in both modes cover successful results, thrown errors, Void, typed Void, async let, and multiple arguments. The standalone iOS suite and all 13 React Native harness tests pass with the updated callers.

@mrousavy
mrousavy added this pull request to stack #1842 October 20, 2026 19:02
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nitro-docs Ready Ready Preview Oct 20, 2026 7:21pm UTC

Request Review

@mrousavy
mrousavy force-pushed the mrousavy/v1-async-callback-call-operator branch from 326c296 to 781939e Compare October 20, 2026 19:20
@mrousavy
mrousavy merged commit 03b3f49 into v1 Oct 20, 2026
9 of 21 checks passed

This branch was successfully deployed

1 active deployment
Preview — 781939e2 Deployed Oct 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant