Skip to content

Conversation

@koloyyee
Copy link
Contributor

Description

  • Change to "to" in SupportedFeatures.md JExtract Java -> Swift section
  • Added "watch" to "you may want to this"
  • Adding an introduction based on the WWDC video

### JExtract: Java -> Swift

SwiftJava's `swift-java jextract` tool automates generating Java bindings from Swift sources.
SwiftJava's `swift-java jextract` tool automates generating Java bindings to Swift sources.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is "from"; we take swift sources as input and generate java; so it's not that the bindings are 'to' swift but that we generate them "from swift sources" 🤔

Maybe this whole sentence needs rewording?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok, I was trying to align with the README line 34

**swift-java jextract** 

Is a source generator which will **generate Java bindings to existing Swift libraries**. 

How about changing the README to "from" for now, and rewording them both afterwards

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went through the subcommand help message. If I am not mistaken, it should be:
wrap-java: Generates Swift bindings from Java code (Java → Swift).
jextract: Generates Java bindings from Swift code (Swift → Java).

TODO: Some general intro

If you prefer a video introduction, you may want to this
**SwiftJava** provides Java and Swift interoperability with minimal overhead. It eliminates the complex, error-prone process such as manually compiling Java classes to C headers for native access. With SwiftJava, developers can achieve a flexible, safe, and high-performance connection between the two languages.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comes of a bit weird, no-one is manually compiling java classes in either approach. Maybe something like

Suggested change
**SwiftJava** provides Java and Swift interoperability with minimal overhead. It eliminates the complex, error-prone process such as manually compiling Java classes to C headers for native access. With SwiftJava, developers can achieve a flexible, safe, and high-performance connection between the two languages.
**SwiftJava** provides a set of tools and libraries to enable Java and Swift interoperability. It allows developers to generate bindings to either language from the other, by using either source generation (for Java consuming Swift code), or by using a combination of Swift macros and source generation (for Swift consuming Java libraries).
The generated code is highly efficient, and less error-prone than manually writing the mappings by hand, and also guarantees memory safety across the boundaries between the languages.

If you prefer a video introduction, you may want to this
**SwiftJava** provides Java and Swift interoperability with minimal overhead. It eliminates the complex, error-prone process such as manually compiling Java classes to C headers for native access. With SwiftJava, developers can achieve a flexible, safe, and high-performance connection between the two languages.

**Interoperability promotes**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Interoperability promotes**
Reasons why you might want to reach for Swift and Java interoperability include, but are not limited to, the following scenarios:

**SwiftJava** provides Java and Swift interoperability with minimal overhead. It eliminates the complex, error-prone process such as manually compiling Java classes to C headers for native access. With SwiftJava, developers can achieve a flexible, safe, and high-performance connection between the two languages.

**Interoperability promotes**
- Incremental adoption of Swift
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Incremental adoption of Swift
- Incremental adoption of Swift, in an existing Java codebase

**Interoperability promotes**
- Incremental adoption of Swift
- Reuse of libraries across languages
- Access libraries with or without native APIs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Access libraries with or without native APIs
- Reuse existing libraries which exist in one ecosystem, but don't have a direct equivalent in the other

- Reuse of libraries across languages
- Access libraries with or without native APIs
- Implement performance-sensitive code in Swift
- Support for ecosystem-specific build tools
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd drop this, as we're just listing why you might want to use this project now

Suggested change
- Support for ecosystem-specific build tools

- Implement performance-sensitive code in Swift
- Support for ecosystem-specific build tools

**Tools**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Tools**
SwiftJava is offering a number of core libraries which support the language interoperability:


**Tools**
- Swift Package:
- JavaKit (Java -> Swift)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- JavaKit (Java -> Swift)
- JavaKit (Swift -> Java) - JNI based support library and Swift macros

- Swift Package:
- JavaKit (Java -> Swift)
- Java Library:
- SwiftKit (Swift -> Java)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- SwiftKit (Swift -> Java)
- SwiftKit (Java -> Swift) - Suport library for Java calling Swift code (either using JNI or FFM)

- Java Library:
- SwiftKit (Swift -> Java)
- Tooling:
- swift-java: command line tool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- swift-java: command line tool
- `swift-java` - command line tool; Supports source generation and also dependency management operations

- SwiftKit (Swift -> Java)
- Tooling:
- swift-java: command line tool
- Build tool integration: SwiftPM Plugin or Gradle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Build tool integration: SwiftPM Plugin or Gradle
- Build tool integration: SwiftPM Plugin

we don't yet have a gradle plugin

Copy link
Collaborator

@ktoso ktoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a bunch of notes to make it flow a bit better. Please have a look; thanks for the effort updating our docs!

@koloyyee
Copy link
Contributor Author

Thank you very much for the feedback! I will update it accordingly

Corrected the direction of interoperability in the documentation and updated the status of Java features.
@ktoso
Copy link
Collaborator

ktoso commented Aug 25, 2025

Thanks :)

@ktoso ktoso merged commit 1d20148 into swiftlang:main Aug 25, 2025
35 of 38 checks passed
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.

2 participants