Intro

Hi, I’m Tadeas and I’ve been working on DX improvements for Swift and KMP for the past few years. One of Touchlab’s core goals is to improve the developer experience with KMP, particularly around tooling and iOS developers. I joined the Touchlab team to help build some great new tools, and bring a more iOS-focused eye to the effort. 

When I transitioned from pure iOS development to KMP, the most important tool I installed was xcode-kotlin plugin. Although the plugin worked, the overall install experience had much room for improvement. Now that I joined Touchlab, I have the opportunity to make such improvements happen. 

Why

We’ve dropped the install script in lieu of a CLI tool. As you probably know, even though Xcode supports plugins, it doesn’t have a plugin ecosystem and management[1]. So to install a plugin, additional logic is required to make sure various parts are put where they need to be. This is especially true for the xcode-kotlin plugin, since it adds support for debugging Kotlin with LLDB, which isn’t supported in Xcode’s plugin API directly.

One of Xcode’s limitations regarding plugins is a requirement that each plugin must state the IDs of all compatible Xcode versions. That meant manually editing a .plist file in the plugin each time a new Xcode version was released. The new tool performs those edits for you automatically so that all Xcode versions installed on the developer’s machine are added to the compatibility list. On top of that, the tool integrates with Xcode better, getting rid of the “Load Bundle” popups (which in certain scenarios cause Xcode to crash).

Thanks to the switch we were also able to add support for installing through Homebrew, which was long overdue. Last but not least, the tools `info` command is helpful in diagnosing issues with the plugin or developer’s environment. To make things even more interesting, we decided to write the CLI tool in Kotlin Native.

Overall the new installation is more robust than before and finally feels more like professional developer tooling. Touchlab believes that improving the iOS dev experience is key to KMP adoption and we’re going to continue to work on ways to support the iOS KMP community. 

Can you take 5 minutes and let us know how you’re using (or will use) the xcode-kotlin plugin in our quick survey?

How to use

As long as you have Homebrew installed, all you need to install the CLI tool is running:

$ ​brew install xcode-kotlin

 

To install the plugin to your Xcode, run:

$ ​xcode-kotlin install

 

The tool will look up all of your Xcode installations and configure the plugin to work in them. Each time you update your Xcode to a newer version, you have to synchronize the plugin installation for the plugin to load.

$ ​xcode-kotlin sync

 

Please check out the docs or create a new issue in our GitHub repository if you encounter any issues.

Work at Touchlab!

If you want to help define the future of Kotlin, and like living a bit on the edge technically speaking, please reach out!

Careers at touchlab

  • [1] Xcode did support much more plugin functionality, and there was a whole open source ecosystem with a plugin manager called Alcatraz. Unfortunately, Apple shut all of that down when they enforced Xcode signatures.