Swift
clear | undo | redo
// Just start typing code...
Kotlin
clear | undo | redo
// Just start typing code...
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
-
D. Schultes. SequalsK—A Bidirectional Swift-Kotlin-Transpiler. IEEE/ACM 8th International Conference on Mobile Software Engineering and Systems (MobileSoft), Madrid, Spain, 2021, pp. 73-83, doi: 10.1109/MobileSoft52590.2021.00017.
(preprint version of the paper (accessible without restrictions) /
talk given on May 19th (YouTube))
-
L. Schneider and D. Schultes. Evaluating Swift-to-Kotlin and Kotlin-to-Swift transpilers. 9th IEEE/ACM International Conference on Mobile Software Engineering and Systems (MOBILESoft '22). Association for Computing Machinery, New York, NY, USA, 2022, pp. 102–106, doi: 10.1145/3524613.3527811.
-
D. Schultes, L. Schneider, T. Heymann and F. Wild.
Native cross-platform app development using the SequalsK transpiler.
Information and Software Technology, Volume 179, 2025, 107626, ISSN 0950-5849, doi: 10.1016/j.infsof.2024.107626.
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.
Positive Examples
Many features already work fine, at least when used in a rather straightforward way. Positive examples are
- basic concepts like variables, functions, print to console, and string interpolation,
- classes including constructors, inheritance and protocol/interface implementation,
- properties including property observers,
- control structures as well as basic usage of arrays and dictionaries,
- enumerations as well as static functions (Swift) / companion objects (Kotlin),
- structs (Swift) / data classes (Kotlin) as well as Swift tuples when introduced using a typealias,
- subscripts,
- closures (Swift) / lambda expressions (Kotlin) as well as optional binding, and
- switch (Swift) / when (Kotlin) statements as well as inout parameters (Swift) / plain call-by-reference (Kotlin).
In addition, there is a
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