SKIE Getting Started Guide
· 3 min read
SKIE (Swift Kotlin Interface Enhancer) is a new tool developed by Touchlab which improves interoperability between Kotlin and Swift by generating Swift wrappers for Objective-C headers created by the Kotlin compiler. It recreates features supported by both languages that are lost in the translation from Kotlin to Objective-C to Swift.
Features
SKIE’s features are in two basic categories: type augmentation and Coroutines interop.
Type augmentation enables exhaustive enums and sealed classes, as well default arguments for function parameters.
Coroutines interop allows you to have suspend functions and Flows in you Kotlin API, and Swift can call them as if Swift was talking to another Swift library. Suspend functions can be called from Swift in an async context, with cancellation support, and from any thread. Flow
becomes a fully functional AsyncSequence
on the Swift side, automatically participating in the async lifecycles of both Kotlin and Swift.
You can deep dive on the SKIE Docs - Features page, but we recommend you finish this doc to see how these features actually work in a real project first.
SKIE Demo
The SKIE Demo is a simple app sample project that shows what SKIE does and how to use it. To get a clear sense of what this tool is all about, this is the place to start.
If you are not familiar with SKIE, DEFINITELY START HERE!
Mobile applications can have complex architectures, and what is considered “best-practice” for constructing an application’s architecture can vary widely. The SKIE Demo application avoids architectural decisions and focuses purely on the enhanced interop between Kotlin and Swift.
Read the SKIE Demo post.
Installation
Detailed install docs are here SKIE Docs - Installation. For a new project, you really just need to add the plugin.
SKIE Migration Guide
SKIE can cause breaking changes in existing code. Coming up with a migration plan is generally straightforward, but if you have existing code, it is important that you have some plan in place. The SKIE Migration Guide discusses various approaches and includes tips from the teams we’ve worked with that put SKIE into their existing KMP code.
Read the SKIE Migration Guide .
Future Content
We have some more posts being published over the next few weeks. These will cover SKIE integration from different perspectives. Make sure to subscribe to our content channels for updates.
KaMP Kit with SKIE
Our reference application, KaMP Kit, is going through some updates. With the open-source launch of SKIE, KaMP Kit will be getting updates to improve the shared code API.
Publishing SDKs with KMMBridge and SKIE
The Swift-facing API from Kotlin can be a major pain point for mobile team adoption of KMP. SKIE makes that API much better. If you plan to “pitch” KMP to your team, start with our updated KMMBridge Kick Start application.