This repository contains two approaches to Swift/Java interopability.
- A Swift library (
JavaKit) and bindings generator that allows a Swift program to make use of Java libraries by wrapping Java classes in corresponding Swift types, allowing Swift to directly call any wrapped Java API. - The
jextract-swifttool which is similar to the JDK'sjextractwhich allows to extract Java sources which are used to efficiently call into Swift from Java.
🚧 🚧 🚧 This is a very early prototype and everything is subject to change. 🚧 🚧 🚧
Parts of this project are incomplete, not fleshed out, and subject to change without any notice.
The primary purpose of this repository is to create an environment for collaboration and joint exploration of the Swift/Java interoperability story. The project will transition to a more structured approach once key goals have been outlined.
This project contains quite a few builds, Swift, Java, and depends on some custom steps.
Easiest way to get going is to:
make
swift test # test all Swift code, e.g. jextract-swift
./gradlew test # test all Java code, including integration tests that actually use jextract-ed sourcesTo run a simple app showcasing a Swift process calling into a Java library you can run:
make runWhich executes a small Java app (com.example.swift.HelloSwift).
To run a simple example app showcasing the jextract (Java calling Swift) approach you can:
make jextract-run
./gradlew runwhich will run JavaSwiftKitDemo sample app.
More details about the project and how it can be used are available in USER_GUIDE.md