-
-
Notifications
You must be signed in to change notification settings - Fork 57
BridgeJS: @JS Protocol with methods support #456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kateinoigakukun
merged 1 commit into
swiftwasm:main
from
PassiveLogic:feat/protocol-support-methods
Oct 22, 2025
Merged
BridgeJS: @JS Protocol with methods support #456
kateinoigakukun
merged 1 commit into
swiftwasm:main
from
PassiveLogic:feat/protocol-support-methods
Oct 22, 2025
+2,612
−107
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@krodak
krodak
force-pushed
the
feat/protocol-support-methods
branch
3 times, most recently
from
October 17, 2025 15:11
c1d778e to
e96d1e8
Compare
[fe09c4b1] Simplify export swift [b42bb7c1] WIP: Simplify protocol method generation [75e1ed37] BridgeJSLink simplification [b1fcc4d0] Cleanup [70aa0332] WIP: Final wrap [2f648eaf] WIP: Protocols simplification [f2f89b33] WIP: Fix for parameters in methods [6026fc1d] WIP: Test protocol methods with parameters
@krodak
krodak
force-pushed
the
feat/protocol-support-methods
branch
from
October 17, 2025 16:18
e96d1e8 to
7efb593
Compare
kateinoigakukun
kateinoigakukun
approved these changes
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
@kateinoigakukun
kateinoigakukun
merged commit Oct 22, 2025
6310307
into
swiftwasm:main
9 checks passed
47 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
Introduction
This PR adds basic support for exporting Swift protocols to JS / TS using BridgeJS plugin.
Overview
BridgeJS now supports exporting Swift protocols as TypeScript interfaces. JavaScript objects implementing these interfaces can be passed to Swift code, where they are automatically wrapped in generated Swift struct that forward method calls and property accesses to the JavaScript implementation.
When you mark a protocol with
@JS, BridgeJS generates:Any{ProtocolName}) that conforms to the protocolCurrent Limitations
This PR covers support for methods and basic types in parameters and return types, as these types are supported in both Export / Import directions.
Support for properties,
Optionaland others will be posted in separate PR as changeset is quite large.Testing
Basic tests with protocol implementation on JS and Swift side used as delegate property of protocol type are added.
Documentation
Added to
Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md