Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Java `native` functions. JavaKit simplifies the type conversions

### 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).


> tip: This direction of interoperability is covered in the WWDC2025 session 'Explore Swift and Java interoperability'
> around the [14-minute mark](https://youtu.be/QSHO-GUGidA?si=b9YUwAWDWFGzhRXN&t=842).
Expand Down
23 changes: 20 additions & 3 deletions Sources/SwiftJavaDocumentation/Documentation.docc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,26 @@ Please refer to articles about the specific direction of interoperability you ar

### Getting started

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.


**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:

- 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

- 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

- 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


**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:

- 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

- 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)

- 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

- 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



If you prefer a video introduction, you may want to watch this
[Explore Swift and Java interoperability](https://www.youtube.com/watch?v=QSHO-GUGidA)
WWDC 2025 session,
which is a quick overview of all the features and approaches offered by SwiftJava.
Expand Down