Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BridgeJS: Change@JS init to generatestatic init() methods instead ofconstructor in JS#409

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
kateinoigakukun merged 10 commits intomainfromyt/bjs-fix-swift-class
Aug 15, 2025

Conversation

@kateinoigakukun
Copy link
Member

@kateinoigakukunkateinoigakukun commentedAug 15, 2025
edited
Loading

Changes@JS init to generate staticinit() methods instead of direct constructors to separate two distinct Swift class instantiation patterns.

Problem

Previously,new SwiftClass() was used for both:

  1. Calling Swift@JS init constructors
  2. Lifting Swift class instances returned from exposed Swift functions (Swift side returns pointer, JS glue code lifts it into wrapper object)

These two operations should not share the same API as they have fundamentally different semantics.

Solution

  • @JS init now generates staticinit() methods for Swift constructor calls
  • new SwiftClass() is reserved for lifting Swift instances returned from Swift functions
  • Fixed handling of Swift classes without@JS init constructors

Changes on generated interface

// BeforeexporttypeExports={Greeter:{new(name:string):Greeter;}}const{ exports}=awaitinstantiate(...)constgreeter=newexports.Greeter("world");// AfterexporttypeExports={Greeter:{init(name:string):Greeter;}}const{ exports}=awaitinstantiate(...)constgreeter=exports.Greeter.init("world");

@kateinoigakukunkateinoigakukun merged commit57a6fa2 intomainAug 15, 2025
9 checks passed
@kateinoigakukunkateinoigakukun deleted the yt/bjs-fix-swift-class branchAugust 15, 2025 16:43
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@kateinoigakukun

[8]ページ先頭

©2009-2025 Movatter.jp