SwiftKotlin
SwiftKotlin copied to clipboard
A tool to convert Swift code to Kotlin.
Async Await function are not currently supported and breaks the conversion. Example: ``` protocol MyProtocol { func myFunction() async -> MyData } ``` Should translates to: ``` interface MyProtocol {...
Fixing issue #126 - `// region NAME_OF_REGION` is a convention used in Kotlin; `// MARK` in Swift works in a similar way, so it's a good idea to convert `//...
In Kotlin, a similar concept for the `// MARK` annotation exists with the ``` // region NAME_OF_REGION ... // endregion ``` It is not something from the language itself, but...
When pasting Java code to a Kotlin file IntelliJ will automatically translate the code into Kotlin. It would be ideal if something similar can be created for Swift to Kotlin...
In kotlin, the default access level for classes, members and variables is `public`, while in Swift is `internal`. As a result, when transpaling code we should also update the access...
This is a big epic as it will require a lot of work on top of the AST to perform type resolutions. From a very high level point of view,...
This Swift code: ``` switch exception { case .qrCode(let name): trackCode(name: name) default: trackError(name: "generic") } ``` Translates to right now to: ``` when (exception) { .qrCode -> trackCode(name =...
Swift allows for custom operators. In Kotlin, operators are restricted to: https://kotlinlang.org/docs/reference/operator-overloading.html Transform the operators that have a Kotlin counterpart. Example: ``` public func + (left: Price, right: Price) ->...
Swift: ``` .reduce(0, +) ``` Translated: ``` .reduce(0, +) ``` Should be translated to: ``` .fold(0.0) { total, next -> total + next } ```
``` if let intent = coordinator.methodName(param1: param1, param2: param2, onComplete: { self.view.let { self.navigationManager.dismiss(view: $0, animated: true) } }) { navigationManager.show(intent, animation: .present) } ``` Translated: ``` val intent =...