DEV Community

Cover image for Swift Klib v0.2.0 is out
Evgeny Khokhlov
Evgeny Khokhlov

Posted on

Swift Klib v0.2.0 is out

Swift Klib Gradle Plugin v0.2.0 is released.

GitHub logo ttypic / swift-klib-plugin

Gradle Plugin for injecting Swift code into Kotlin Multiplatform Mobile shared module

Swift Klib library logo


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: This plugin is still under development, it works quite well for my private projects. But it hasn't been tested in different environments and setups. If you like the idea of the project and have trouble with setup, don't hesitate and create issue or start a discussion. Any feedback is very much appreciated.

Note: Plugin has been tested on Gradle 7.5+, Xcode 13+

Installation

Using the plugins DSL:

plugins {
    id("io.github.ttypic.swiftklib") version "0.2.0"
}
Enter fullscreen mode Exit fullscreen mode

Using legacy plugin application:

buildscript {
  repositories {
    maven {
      url = uri("
Enter fullscreen mode Exit fullscreen mode

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)