Swift Klib Gradle Plugin v0.2.0 is released.
ttypic / swift-klib-plugin
Gradle Plugin for injecting Swift code into Kotlin Multiplatform Mobile shared module
Swift Klib Gradle Plugin
This gradle plugin provides easy way to include your Swift source files in your Kotlin Multiplatform Mobile
shared module and access them in Kotlin via cinterop
for iOS targets. It is useful for:
- Accessing Swift-only libraries (e.g. CryptoKit)
- Creating a Kotlin-Friendly Swift API
- Learning how Swift <-> Kotlin interoperability works
Note: Plugin has been tested on Gradle 7.5+, Xcode 15+
Installation
Using the plugins DSL:
plugins {
id("io.github.ttypic.swiftklib") version "0.5.1"
}
Using legacy plugin application:
buildscript {
repositories {
maven {
url = uri("https://plugins.gradle.org/m2/")
}
}
dependencies {
classpath("io.github.ttypic:plugin:0.5.1")
}
}
apply(plugin = "io.github.ttypic.swiftklib")
Usage
Plugin works together with Kotlin Multiplatform plugin.
Prepare Swift code
Place your Swift files inside your project in separate folder (e.g. native/HelloSwift
).
Make sure that Swift API you want…
This gradle plugin provides easy way to include your Swift source files in your Kotlin Multiplatform Mobile
shared module and access them in Kotlin via cinterop
for iOS targets. It is useful for:
- Accessing Swift-only libraries (e.g. CryptoKit)
- Creating a Kotlin-Friendly Swift API
- Learning how Swift <-> Kotlin interoperability works
This release contains:
- Fix: add a step to clean old build files in the build directory
- Light refactoring of source code
Top comments (0)