Skip to content

readdle/swift-java-codegen

Folders and files

NameName
Last commit message
Last commit date
May 31, 2024
May 7, 2024
Oct 20, 2023
May 18, 2021
Jun 4, 2024
Sep 23, 2019
May 31, 2018
May 18, 2021
Jun 4, 2024
Sep 10, 2021
Oct 20, 2023
Oct 20, 2023
May 18, 2021
May 18, 2021
Mar 2, 2018

Repository files navigation

Swift Java Codegeneration annotation processor Maven Central

Annotation processor that generate Swift JNI code for Kotlin headers

Pre-requirements

This annotation process only generate Swift JNI code. For compiling swift code for Android please use Swift Android Gradle plugin

Setup

  1. Add the following to your root build.gradle
allprojects {
    repositories {
        mavenCentral()
    }
}
  1. Add the following to your project build.gradle
dependencies {
    kapt "com.readdle.swift.java.codegen:compiler:$swift-java-codegen-version"
    implementation "com.readdle.swift.java.codegen:annotations:$swift-java-codegen-version"
}

Usage

Documentation in progress...

Samples

There are few samples that use Swift Java Codegen:

  1. Sample in this repo
  2. Kotlin sample for Desktop
  3. Cross-platform swift weather app

FAQ

Why this project has Java in it name but doesn't support Java?

When this project was started Kotlin was in beta development. That's why we decide to move on with Java as primary language. After 4 year of development we moved to Kotlin and break Java support. If for some reason you would like to use this project with Java, latest Java support version us stil available on Maven Central.

Could I generate Swift JNI without writing Kotlin headers manually?

Very good question. Probably it's possible but it's quite complicated. We invest time to research code generation based on Swift and have a small prototype. But the development of this new tool is still at a very early stage.