[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7049":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":9,"rankLanguage":9,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":9,"pushedAt":9,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":26,"discoverSource":27},7049,"SwiftKotlin","angelolloqui\u002FSwiftKotlin","angelolloqui","A tool to convert Swift code to Kotlin.",null,"Swift",2922,195,89,16,0,2,59.08,"MIT License",false,"develop",true,[],"2026-06-12 04:00:32","![](Assets\u002Flogo_small.png)\n\n![status](https:\u002F\u002Ftravis-ci.org\u002Fangelolloqui\u002FSwiftKotlin.svg?branch=develop)\n![Swift 5](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fswift-5-brightgreen.svg)\n![Swift Package Manager](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FSPM-ready-orange.svg)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-lightgrey.svg?maxAge=2592000)](https:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT)\n[![Twitter](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Ftwitter-@angelolloqui-blue.svg?maxAge=2592000)](http:\u002F\u002Ftwitter.com\u002Fangelolloqui)\n\n# SwiftKotlin\n\nA tool to convert Swift code to Kotlin in a very easy and quick way.\n\n![](Assets\u002Fscreenshot.png)\n\n# What is this?\n\nSwiftKotlin is a framework, a command line tool and a Mac application for **translating Swift code into Kotlin**.\n\nIt applies transformations to the Swift code to get as correct as possible Kotlin code (see limitations below). It does string transformations as well as some more complicated ones like transforming `guard` statements to negative `if` statements, properties, memory management and many others.\n\nIt comes with a desktop Mac application to copy & paste your code, as well as a command line tool to transform a complete project to Kotlin.\n\n\n## Why use SwiftKotlin?\n\n### Why Kotlin?\nKotlin is a great language, it is to Android\u002FJava what Swift is to iOS\u002FObjective-C. It adds lots of great features while at the same time it keeps complete interop with Java, which means that you can combine them both together as you prefer. \n\n**If you are a Swift developer**, you will love Kotlin. It provides the most important Swift features (optionals, extensions, generics, lambdas,...) and a very similar syntax. You can check a [side by side comparison of Swift and Kotlin here](https:\u002F\u002Fnilhcem.github.io\u002Fswift-is-like-kotlin\u002F).\n\n**If you are a Java developer**, you will find in Kotlin a much more modern and safer language (optionals and mutation). It is a pleasure to write Kotlin code, much more readable and compact than the Java counterpart. You can check some of the [benefits and differences in Kotlin official documentation](https:\u002F\u002Fkotlinlang.org\u002Fdocs\u002Freference\u002Fcomparison-to-java.html) and a [nice list of reasons to chose Kotlin over Java](https:\u002F\u002Fmedium.freecodecamp.com\u002Fwhy-kotlin-is-my-next-programming-language-c25c001e26e3#.hjam7bscd).\n\nMoreover, Kotlin is fully integrated in IntelliJ (Android Studio), so you can keep using the \"de facto\" IDE for Android with all the added benefits brought by Google, and it even has a Java to Kotlin converter if you want to update your legacy Java.\n\nOn top of that, if you consider the similarities between Swift and Kotlin, you can easily convert code in one language to the other one, and have Swift developers writing Kotlin (and *vice versa*) with ease. That is, in fact, the purpose of this project, to help you with that conversion.\n\n\n### Benefits over shared code across platforms\nThere are many alternatives for making multiplatform projects or sharing code between them. Some alternatives are [Xamarin](https:\u002F\u002Fwww.xamarin.com\u002F), [ReactNative](https:\u002F\u002Ffacebook.github.io\u002Freact-native\u002F), [Cordova](https:\u002F\u002Fcordova.apache.org\u002F) or low level C++ libraries.\n\nThe main issue with all of them is that once you chose to use them, you need to keep in their boundaries, including specific tools and libraries, introducing a steep learning curve and a big risk in terms of dependency on that 3rd party. Besides that, for many of those options the resulting app will lack the quality of a fully native app.\n\nOn the other hand, by using Kotlin, you will still have 2 fully native applications, with all the benefits (best quality, performance, best tools per platform -Xcode\u002FAndroid Studio-, follow platform conventions,...), but at the same time minimize the extra work required to translate between them due to the similarity with Swift. \n\nIn fact, [I explored an actual example using MVVM+Rx](http:\u002F\u002Fangelolloqui.com\u002Fblog\u002F38-Swift-vs-Kotlin-for-real-iOS-Android-apps), where I got between a 50% and 90% of code similarity depending on the layer (non UIKit dependent is much more reusable than UIKit dependent classes of course). It took me around 30% the time to convert the Android version from the iOS version and I did not have SwiftKotlin then. ;)\n\n\n## Limitations\nDespite the similarities, Swift and Kotlin are different languages, with some intrinsic differences in them that cannot be fully translated. Besides that, they both run in different environments and have access to very different frameworks and system libraries.\n\nBecause of that, this **tool does not have as a goal to produce production ready Kotlin code**, but just a Kotlin translation that **will require manual editing**. For example, things as simple as adding a new item to an array have different method names:\n\n```swift\n\u002F\u002F Swift\narray.append(\"This is in Swift\")\n```\n```kotlin\n\u002F\u002F Kotlin\narray.add(\"This is in Kotlin\")\n```\n\nThe scope of this project is not mapping all existing methods and data types to their Kotlin counterpart, but to translate the language itself. This means that manual editing will be required afterwards, especially when dealing with system libraries. It is intentional and important that the developer checks the output.\n\n\n## Status\n\n\nThe project is in active development, with many rules and improvements still to be implemented. Some of them include:\n\n- [x] Constructors\n- [x] Simple Control flow statments (`guard`, `if`, `for`, `while`, `switch`)\n- [x] Composed Control flow statments (multiple `guard`, `if let`)\n- [x] Extensions\n- [x] Keyword replacements (`val`, `this`, `fun`, ...)\n- [x] Basic memory management (`weak`, captures,...)\n- [x] Function returns and named parameters\n- [x] Basic property transfromers (getters and setters)\n- [x] Lazy properties \n- [x] Properties with `didSet`\u002F`willSet`\n- [x] Static to Companion\n- [x] Struct to data class\n- [x] String interpolators\n- [x] Foundation types (arrays, maps,...)\n- [x] Basic exception handling syntax\n- [x] Simple enums\n- [x] Complex enum cases to Sealed classes\n- [ ] ... [(check open issues)](https:\u002F\u002Fgithub.com\u002Fangelolloqui\u002FSwiftKotlin\u002Fissues)\n\nWith the implemented rules you can already get pretty decent Kotlin output for many of your classes. The rest will come in future releases.\n\n\n## Installation\n\nThe project comes with 2 executable targets:\n\n- **SwiftKotlinCommandLine**\n- **SwiftKotlinApp**\n\nCheckout the [project's releases page](https:\u002F\u002Fgithub.com\u002Fangelolloqui\u002FSwiftKotlin\u002Freleases) to get a preview compiled version of the app or compile it manually:\n\n- Install Xcode 11+ and check it is the default selected one by running `xcode-select -p`\n- clone the repo: `git clone git@github.com:angelolloqui\u002FSwiftKotlin.git; cd SwiftKotlin`\n- Run `swift package update` and `swift package generate-xcodeproj --enable-code-coverage`\n- Open the project: `open SwiftKotlin.xcworkspace`\n\nFrom Xcode, run the desired target and copy the generated executables (you can find it under the `Products` generated folder) in a directory with executable rights for later use. Typically, you could use:\n\n- **swiftkotlin** command line tool: `\u002Fusr\u002Flocal\u002Fbin\u002F`\n- **SwiftKotlinApp** desktop app: `\u002FApplications\u002F`\n\nNOTE: If you upgrade any project dependencies, make sure you run:\n`swift package generate-xcodeproj --enable-code-coverage` after upgrade\n\n## Usage\n### Command line tool\nIf you placed `swiftkotlin` in any of your path directories, just run: `swiftkotlin [\u003Cfile>] [--output path]`\n\nNote that you can specify a directory as input. Output will by default use the input directory, creating a `\u003Cname>.kt` file for each existing `\u003Cname>.swift` file found. \n\n\n## License\n\nMIT licensed.\n\n## Collaboration\n\nForks, patches and other feedback are always welcome.\n\nFor a list of missing features, check the disabled Unit Tests.\n\n\n## Credits\n\nSwiftKotlin uses [Swift-Transform](https:\u002F\u002Fgithub.com\u002Fyanagiba\u002Fswift-transform) and [Swift-AST](https:\u002F\u002Fgithub.com\u002Fyanagiba\u002Fswift-ast) for generating the AST for transpilation.\n\nSwiftKotlin is brought to you by [Angel Garcia Olloqui](http:\u002F\u002Fangelolloqui.com). You can contact me on:\n\n- Project Page: [SwiftKotlin](https:\u002F\u002Fgithub.com\u002Fangelolloqui\u002FSwiftKotlin)\n- Personal webpage: [angelolloqui.com](http:\u002F\u002Fangelolloqui.com)\n- Twitter: [@angelolloqui](http:\u002F\u002Ftwitter.com\u002Fangelolloqui)\n- LinkedIn: [angelolloqui](http:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fangelolloqui)\n\nAnd special credits for the contributors:\n- [Ryuichi Sai](https:\u002F\u002Fgithub.com\u002Fryuichis)\n- [jonnermut](https:\u002F\u002Fgithub.com\u002Fjonnermut)\n- [Tomohiro Matsuzawa](https:\u002F\u002Fgithub.com\u002Fthmatuza)\n- [Tor Langballe](https:\u002F\u002Fgithub.com\u002Ftorlangballe)\n- [Levi Dahlstrom](https:\u002F\u002Fgithub.com\u002FLeviDahl)\n- [Shaurya](https:\u002F\u002Fgithub.com\u002Fshaurya-ObjC)\n","SwiftKotlin 是一个将 Swift 代码转换为 Kotlin 代码的工具。其核心功能包括字符串转换及复杂的语法结构转换，如将 Swift 中的 `guard` 语句转换为 Kotlin 的负 `if` 语句、属性处理以及内存管理等。该工具提供了一个桌面 Mac 应用程序和命令行工具，方便用户通过复制粘贴或批量处理整个项目来完成转换工作。SwiftKotlin 特别适合于希望将 iOS 平台上的 Swift 代码迁移到 Android 平台并使用 Kotlin 编程语言的开发者，或是对于想要探索 Kotlin 语言特性的 Swift 开发者来说也是一个极好的学习辅助工具。","2026-06-11 03:10:18","top_language"]