SequalsK - A Bidirectional Transpiler

Automatically convert source code from Swift to Kotlin and from Kotlin to Swift

Swift

clear | undo | redo
// Just start typing code...
wait for input

Kotlin

clear | undo | redo
// Just start typing code...
wait for input

Usage

Just start typing code! Entering valid Swift code automatically generates corresponding Kotlin code and vice versa. This is work on progress. Last update of the transpiler: ... (Version ...). Also available as a plugin for Android Studio.

Publications

Motivation

We assume that during app development a pattern like MVC (model-view-controller) is used. In a multi-platform project (Android and iOS), in particular if the model consists of a significant amount of business logic, it would be advantageous to automatically transpile the Kotlin source code of the model into Swift source code and vice versa. In the best case, we want to achieve that the translated code is syntactically and semantically correct without the need for manual rework. A bidirectional transpiler allows both the Kotlin and the Swift developers in a multi-platform app development project to improve and extend the code of the model using their own prefered programming language and provide the improved and then transpiled code to their colleagues.

Negative Examples

However, there is still a lot of work to do. Several things are not supported yet. Negative examples are Swift's guard statement, most methods of arrays and dictionaries, annotations, reliable handling of Swift value types versus Kotlin reference types, abstract classes, and some more.


by Dominik Schultes, Technische Hochschule Mittelhessen