From 62ce8669338c2e008593f02bb09ee4b86201f372 Mon Sep 17 00:00:00 2001 From: koloyyee Date: Sat, 9 Aug 2025 09:36:32 -0400 Subject: [PATCH 1/9] update gitgnore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 28dfbae29..b72ffed5f 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ bin/ BuildLogic/out/ .index-build .build-vscode +**/.vscode # Ignore gradle build artifacts .gradle @@ -45,3 +46,4 @@ Package.resolved */**/*.swiftdeps */**/*.swiftdeps~ */**/.docc-build/ + From dce871fd2419462888cb154f8159b6358aedb5d6 Mon Sep 17 00:00:00 2001 From: koloyyee Date: Thu, 21 Aug 2025 14:37:13 -0400 Subject: [PATCH 2/9] align with README JExtract from Java to Swift --- .../Documentation.docc/SupportedFeatures.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SwiftJavaDocumentation/Documentation.docc/SupportedFeatures.md b/Sources/SwiftJavaDocumentation/Documentation.docc/SupportedFeatures.md index c5de6c454..5160b04bc 100644 --- a/Sources/SwiftJavaDocumentation/Documentation.docc/SupportedFeatures.md +++ b/Sources/SwiftJavaDocumentation/Documentation.docc/SupportedFeatures.md @@ -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. > 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). From 0ca4e7e7572411ad9a1b2a2b5608ae546da08c18 Mon Sep 17 00:00:00 2001 From: koloyyee Date: Thu, 21 Aug 2025 14:38:03 -0400 Subject: [PATCH 3/9] add watch to 'you may want to this' --- Sources/SwiftJavaDocumentation/Documentation.docc/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SwiftJavaDocumentation/Documentation.docc/index.md b/Sources/SwiftJavaDocumentation/Documentation.docc/index.md index 7c695a710..456bbaab7 100644 --- a/Sources/SwiftJavaDocumentation/Documentation.docc/index.md +++ b/Sources/SwiftJavaDocumentation/Documentation.docc/index.md @@ -13,7 +13,7 @@ Please refer to articles about the specific direction of interoperability you ar TODO: Some general intro -If you prefer a video introduction, you may want to this +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. From 12d5412cb937eea0c4deb33721c9bf627dd9bb81 Mon Sep 17 00:00:00 2001 From: koloyyee Date: Thu, 21 Aug 2025 14:48:47 -0400 Subject: [PATCH 4/9] add intro to SwiftJavaDocumentation index.md --- .../Documentation.docc/index.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Sources/SwiftJavaDocumentation/Documentation.docc/index.md b/Sources/SwiftJavaDocumentation/Documentation.docc/index.md index 456bbaab7..71683e338 100644 --- a/Sources/SwiftJavaDocumentation/Documentation.docc/index.md +++ b/Sources/SwiftJavaDocumentation/Documentation.docc/index.md @@ -11,7 +11,21 @@ Please refer to articles about the specific direction of interoperability you ar ### Getting started -TODO: Some general intro +**SwiftJava** provides Java and Swift interoperability with minimal overhead. It eliminates the complex, error-prone process of 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 +- Reuse of libraries +- Support for ecosystem-specific build tools + +#### Tools +- Swift Package: + - JavaKit (Java -> Swift) +- Java Library: + - SwiftKit (Swift -> Java) +- Tooling: + - swift-java: command line tool [SwiftJavaCommandLineTool](#SwiftJavaCommandLineTool) + - Build tool integration: SwiftPM Plugin or Gradle [SwiftPMPlugin](#SwiftPMPlugin) 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) From 77a818b3778ee5ca6e09abde644716b5353168e5 Mon Sep 17 00:00:00 2001 From: koloyyee Date: Thu, 21 Aug 2025 14:49:54 -0400 Subject: [PATCH 5/9] add intro to SwiftJavaDocumentation index.md --- Sources/SwiftJavaDocumentation/Documentation.docc/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/SwiftJavaDocumentation/Documentation.docc/index.md b/Sources/SwiftJavaDocumentation/Documentation.docc/index.md index 71683e338..695e8caa5 100644 --- a/Sources/SwiftJavaDocumentation/Documentation.docc/index.md +++ b/Sources/SwiftJavaDocumentation/Documentation.docc/index.md @@ -24,8 +24,8 @@ Please refer to articles about the specific direction of interoperability you ar - Java Library: - SwiftKit (Swift -> Java) - Tooling: - - swift-java: command line tool [SwiftJavaCommandLineTool](#SwiftJavaCommandLineTool) - - Build tool integration: SwiftPM Plugin or Gradle [SwiftPMPlugin](#SwiftPMPlugin) + - swift-java: command line tool + - Build tool integration: SwiftPM Plugin or Gradle 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) From 85babfad3831b9eab523ff87abedef80f8053518 Mon Sep 17 00:00:00 2001 From: koloyyee Date: Thu, 21 Aug 2025 15:00:58 -0400 Subject: [PATCH 6/9] add intro to SwiftJavaDocumentation index.md --- .../Documentation.docc/index.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Sources/SwiftJavaDocumentation/Documentation.docc/index.md b/Sources/SwiftJavaDocumentation/Documentation.docc/index.md index 695e8caa5..3acf24a45 100644 --- a/Sources/SwiftJavaDocumentation/Documentation.docc/index.md +++ b/Sources/SwiftJavaDocumentation/Documentation.docc/index.md @@ -11,14 +11,16 @@ Please refer to articles about the specific direction of interoperability you ar ### Getting started -**SwiftJava** provides Java and Swift interoperability with minimal overhead. It eliminates the complex, error-prone process of 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 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 +**Interoperability promotes** - Incremental adoption of Swift -- Reuse of libraries +- Reuse of libraries across languages + - Access libraries with or without native APIs + - Implement performance-sensitive code in Swift - Support for ecosystem-specific build tools -#### Tools +**Tools** - Swift Package: - JavaKit (Java -> Swift) - Java Library: @@ -27,6 +29,7 @@ Please refer to articles about the specific direction of interoperability you ar - swift-java: command line tool - Build tool integration: SwiftPM Plugin or Gradle + 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, From 75ac35127a636758ae2cacda3719d71fb131174c Mon Sep 17 00:00:00 2001 From: David Ko Date: Fri, 22 Aug 2025 16:40:26 -0400 Subject: [PATCH 7/9] Revise SwiftJava documentation for clarity and detail --- .../Documentation.docc/index.md | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/Sources/SwiftJavaDocumentation/Documentation.docc/index.md b/Sources/SwiftJavaDocumentation/Documentation.docc/index.md index 3acf24a45..460f396d5 100644 --- a/Sources/SwiftJavaDocumentation/Documentation.docc/index.md +++ b/Sources/SwiftJavaDocumentation/Documentation.docc/index.md @@ -11,24 +11,19 @@ Please refer to articles about the specific direction of interoperability you ar ### Getting started -**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 a combination of Swift macros and source generation (for Swift consuming Java libraries). -**Interoperability promotes** -- Incremental adoption of Swift -- Reuse of libraries across languages - - Access libraries with or without native APIs - - Implement performance-sensitive code in Swift -- Support for ecosystem-specific build tools +The generated code is highly efficient and less error-prone than manually mapping, and also guarantees memory safety across the boundaries between the languages. -**Tools** -- Swift Package: - - JavaKit (Java -> Swift) -- Java Library: - - SwiftKit (Swift -> Java) -- Tooling: - - swift-java: command line tool - - Build tool integration: SwiftPM Plugin or Gradle +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 in an existing Java codebase +- Reuse existing libraries which exist in one ecosystem, but don't have a direct equivalent in the other +SwiftJava is offering several core libraries which support language interoperability: +- `JavaKit` (Swift -> Java) - JNI-based support library and Swift macros +- `SwiftKit` (Java -> Swift) - Support library for Java calling Swift code (either using JNI or FFM) +- `swift-java` - command line tool; Supports source generation and also dependency management operations +- Build tool integration - SwiftPM 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) @@ -42,7 +37,7 @@ which is a quick overview of all the features and approaches offered by SwiftJav - -### Source generation +### Source Generation - - From 321217f555dfd3a6ba7823724fa3006bfaab0cb8 Mon Sep 17 00:00:00 2001 From: David Ko Date: Fri, 22 Aug 2025 16:51:16 -0400 Subject: [PATCH 8/9] Update SupportedFeatures.md for accuracy Corrected the direction of interoperability in the documentation and updated the status of Java features. --- .../Documentation.docc/SupportedFeatures.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/SwiftJavaDocumentation/Documentation.docc/SupportedFeatures.md b/Sources/SwiftJavaDocumentation/Documentation.docc/SupportedFeatures.md index 5160b04bc..393e7c6a6 100644 --- a/Sources/SwiftJavaDocumentation/Documentation.docc/SupportedFeatures.md +++ b/Sources/SwiftJavaDocumentation/Documentation.docc/SupportedFeatures.md @@ -33,12 +33,12 @@ Java `native` functions. JavaKit simplifies the type conversions | Java `abstract class` | TODO | | Java `enum` | ❌ | | Java methods: `static`, member | ✅ `@JavaMethod` | -| **This list is very work in progress** | | +| **This list is very work in progress** | | -### JExtract: Java -> Swift +### JExtract: Swift -> Java -SwiftJava's `swift-java jextract` tool automates generating Java bindings to Swift sources. +SwiftJava's `swift-java jextract` tool automates generating Java bindings from Swift sources. > 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). From 08aed2462435bb5e7daa8554ebf61fb9e85c5351 Mon Sep 17 00:00:00 2001 From: Konrad `ktoso` Malawski Date: Mon, 25 Aug 2025 16:52:34 +0900 Subject: [PATCH 9/9] Apply suggestions from code review --- .../Documentation.docc/SupportedFeatures.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SwiftJavaDocumentation/Documentation.docc/SupportedFeatures.md b/Sources/SwiftJavaDocumentation/Documentation.docc/SupportedFeatures.md index 393e7c6a6..8d1931496 100644 --- a/Sources/SwiftJavaDocumentation/Documentation.docc/SupportedFeatures.md +++ b/Sources/SwiftJavaDocumentation/Documentation.docc/SupportedFeatures.md @@ -36,7 +36,7 @@ Java `native` functions. JavaKit simplifies the type conversions | **This list is very work in progress** | | -### JExtract: Swift -> Java +### JExtract – calling Swift from Java SwiftJava's `swift-java jextract` tool automates generating Java bindings from Swift sources.