Kotlin Native Xcode Plugin


Kotlin Native Xcode Support

Plugin to facilitate debugging iOS applications using Kotlin Native in Xcode. Defines Kotlin files as source code, with basic highlighting. Allows you to set breakpoints and includes llvm support to view data in the debug window. Xcode does not officially support custom language definitions, but they also don't explicitly block them.

We're Hiring!

Touchlab is looking for a Mobile Developer, with Android/Kotlin experience, who is eager to dive into Kotlin Multiplatform Mobile (KMM) development. Come join the remote-first team putting KMM in production. More info here.


There are 2 parts to Kotlin support: 1) debugging support and 2) language color and style formatting.

You need to tell Xcode that *.kt files are source files, and run an lldb formatter script when debugging starts. Advanced users may want to do this manually, but if you have Xcode installed in the default place, you can run the setup script.

Unless you're using Xcode 11 (in which case look here for help), the following script will install both debugging and formatting support:



If properly set up, you should be able to add Kotlin source to Xcode, set up breakpoints, and step through code. To add Kotlin source to Xcode, follow these steps:

  1. Add a New Group to the Xcode project.
  2. Add Files to the newly created group (Kotlin Debug in this instance).
  3. Select the folders in the Kotlin library that are directly relevant to the iOS build, which will usually be commonMain and iosMain. Make sure "Copy items into destination group's folder (if needed)" is unchecked.

When you're done, your Xcode project structure should look something like this:


The project used as an example above is KaMPKit. Check it out if you want to see a project that already includes Kotlin file references in Xcode. It's an excellent template for Kotlin multiplatform mobile projects.


Setting up the Plugin has been an amalgam of various source projects, as Xcode "Plugins" are undocumented. The most significant piece, the language color file came from other color files shipped with Xcode. Xcode plugin file from GraphQL

LLDB formatting originally comes from the Kotlin/Native project, source konan_lldb.py, although the way data is grabbed has been heavily modified to better support an interactive debugger.

Possible Future Stuff

Check out the Discussions.

Xcode Updates

Every time Xcode is updated we need the UUID. It needs to be added to Kotlin.ideplugin/Contents/Info.plist. To find the UUID of your version of Xcode, run the following:

defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID

Info from here

  • Pointer sometimes invalid

    Pointer sometimes invalid

    Not sure exactly why, but sometimes the pointer isn't valid. I'm not sure if this is for any data, just arrays, or whatever. The old "check" method would simply skip over invalid pointers. That may be fine, but I'd like to understand what's actually happening.

    opened by kpgalligan 2
  • Xcode 12.3 support

    Xcode 12.3 support

    It would seems as though the latest update to xcode, 12.3, has broken support for xcode-kotlin. I've tried removing and reinstalling the plugin. When booting xcode, I no longer get the prompt to load the plugin bundle.

    opened by NotBrandon 2
  • Does not work with Xcode 11.2.1

    Does not work with Xcode 11.2.1

    While the DVTPlugInCompatibilityUUID seems to be included in the Plugin Plist, (A74FBA51-FFEA-4409-B976-6FC3225A6F64), Xcode does not seem to approve of that Plugin. Upon Clicking "Load Plugin", Xcode quits, and upon new launches, it will display the dialog to load the plugin, but then immediately quit without the plugin.

    I am using [email protected]

    opened by below 2
  • Added xcode 11.3 to supported versions

    Added xcode 11.3 to supported versions

    Seems like the plugin works for xcode 11.3, so I added it to the supported xcode versions list.

    opened by aarsland 2
  • Xcode 12.4 Support

    Xcode 12.4 Support

    Xcode 12.4 Support

    opened by paraselene 1
  • Changing file permissions

    Changing file permissions

    setup-xcode11.sh was not executable

    opened by jaspervp 1
  • fix typo

    fix typo

    opened by Foso 1
  • Xcode 12.0 Support

    Xcode 12.0 Support

    Xcode 12.0 (12A7209) Support

    opened by paraselene 1
  • Xcode 12.2 Support

    Xcode 12.2 Support

    Xcode 12.2 Support

    opened by paraselene 1
  • [feature] Additional Kotlin keywords

    [feature] Additional Kotlin keywords

    Add missing Kotlin keywords :

    • data (for data class)
    • object
    • override
    • sealed (for sealed class)
    • when
    opened by jtouzy 1
  • I can't jump to definition of functions implementation

    I can't jump to definition of functions implementation

    How can I jump to definition, XCode 12

    opened by yuzhiyunAtTencent 0
  • Reference .kt files from a swift package manager pulled repo

    Reference .kt files from a swift package manager pulled repo

    So far the plugin has worked great for me, but I think there is an opportunity to make it even smoother. I have a Kotlin/Native project that generates an xcframework which I then pull in via swift package manager. When I have the Kotlin/Native project locally and registered as a Folder Reference in XCode it works great, but on a new machine where I don't have the original repo synced I cannot easily add breakpoints. Because SPM is based on the git repo it already is syncing all of the .kt files associated with the xcframework. Is there an easy way to make the plugin have access to these files? It would make it much easier for an iOS developer to debug the internals without needing a lot of additional steps.

    The files get synced to /Users/username/Library/Developer/Xcode/DerivedData/Packagename-byqdevosfmstyigxngorlffhsqub/SourcePackages/checkouts

    opened by TrevorStoneEpic 2
  • Use current default Xcode path when multiple Xcode installations are present

    Use current default Xcode path when multiple Xcode installations are present

    Currently hard-coded Xcode path is used during the plugin installation (/Applications/Xcode.app). When you have multiple Xcode installations you want this plugin to be installed for "current default Xcode".

    P.S. My main intention is to raise the issue and propose at least one solution. Thus feel free to do any adjustments to this PR if required - my core expertise is rather Android then iOS.

    opened by AlexTrotsenko 0
  • Xcode debug speed

    Xcode debug speed

    The speed of the debug is very slow ? any advice ? my xcode version is 11.6 (11E708)

    opened by LNeway 7
  • PrintObject (po) statement doesn't work

    PrintObject (po) statement doesn't work

    I did everything described in Readme Now I'm able to use breakpoints but not able to use "po" statement or see an object state when code execution stopped at a breakpoint inside my common code.

    Kotlin.ideplugin, Kotlin.xclangspec, Xcode.SourceCodeLanguage.Kotlin.plist are in the right place. Tried to reinstall the plugin but got the same issue.

    Does it work as expected? I use Xcode 11.2 GM, macOs 10.14.4, KotlinNative 1.3.71

    opened by romanandreyvich 4
  • Add sources as folder reference instead of using xcodeSync Gradle plugin

    Add sources as folder reference instead of using xcodeSync Gradle plugin

    Using the xcode gradle sync plugin add the Kotlin source files in groups inside the XCode project. This forces the script to be run everytime a Kotlin source file is created or moved.

    Instead, I suggest creating Folder References on the XCode project pointing to the commonMain and iOSMain in the Kotlin project. This allows debugging in the same way in Xcode, and ensures that the sources are always being up to date.

    Special notice : be careful not to add the folder reference to the target, otherwise all your Kotlin sources will be exported in your .ipa bundle.

    opened by remysanfeliu 2
  • Install script should remove and reinstall files

    Install script should remove and reinstall files

    To get the plugin to work after upgrading Xcode, several people have had to completely remove the files and reinstall them. This should be verified and added to the setup process.

    opened by kpgalligan 0
  • Don't create folders in Xcode when no source in them

    Don't create folders in Xcode when no source in them

    The sync process creates all folders it finds, even if there is nothing in them. We should avoid creating folders when there's no data in them.

    opened by kpgalligan 0
  • Evaluate Rust lldb formatters

    Evaluate Rust lldb formatters

    Rust lldb formatters seem to support much more formatting and may produce much better type info in the debugger. The lldb docs aren't easy to parse, so looking at the rust sample should tell us a lot: https://github.com/vadimcn/vscode-lldb/blob/master/formatters/rust.py

    opened by kpgalligan 0
Sync Kotlin files with an Xcode project

Kotlin Xcode Sync Note Soon to be deprecated. You can add folder references instead. See here. Import kotlin files into an Xcode project. This is used

null 24 May 1, 2021
KaMP Kit by Touchlab is a collection of code and tools designed to get your mobile team started quickly with Kotlin Multiplatform.

KaMP Kit Welcome to the KaMP Kit! About Goal The goal of the KaMP Kit is to facilitate your evaluation of Kotlin Multiplatform (aka KMP). It is a coll

Touchlab 1.2k Aug 2, 2021
AppCode helper for Kotlin/Native and Xcode

Kotlin Xcode compatibility Gradle plugin The plugin is used by AppCode to set up Kotlin/Native project along with Xcode Sources A multi-build sample w

Kotlin 22 Feb 15, 2021
BuildConfig for Kotlin Multiplatform Project

BuildKonfig BuildConfig for Kotlin Multiplatform Project. It currently supports embedding values from gradle file. Table Of Contents Motivation Usage

Yasuhiro SHIMIZU 187 Jul 28, 2021
Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.

Codename One - Cross Platform Native Apps with Java or Kotlin Codename One is a mobile first cross platform environment for Java and Kotlin developers

Codename One 1k Aug 5, 2021
Mobile client for official Nextcloud News App written as Kotlin Multiplatform Project

Newsout Android and iOS mobile client for Nextcloud news App. The Android client is already available to download in the Play Store. F-Droid and Apple

Simon Schubert 117 Apr 16, 2021
💫 A Gradle Plugin to generate your networking code from Swagger

Swagger Gradle Codegen A Gradle plugin to generate networking code from a Swagger spec file. This plugin wraps swagger-codegen, and exposes a configur

Yelp.com 356 Jul 21, 2021
Kotlin multiplatform benchmarking toolkit

NOTE: Starting from version 0.3.0 of the library: The library runtime is published to Maven Central and no longer published to Bintray. The Gradle plu

Kotlin 167 Jul 28, 2021
A React Native library making file access easier for developers as first class citizens, without the tears

React Native File Gateway A React Native library making file access easier for developers as first class citizens, without the tears. ⚠️ NOTE: This li

Jimmy Wei 4 Jun 6, 2021
Kotlin Multiplatform Mobile App Template

KMMT : Kotlin Multiplatform Mobile Template Kotlin Multiplatform Mobile Development Simplified KMMT is a KMM based project template designed to simpli

Jitty Andiyan 117 Jul 19, 2021
DI can be simple. Forget about modules and components. Just use it!

PopKorn - Kotlin Multiplatform DI PopKorn is a simple, powerful and lightweight Kotlin Multiplatform Dependency Injector. It doesn't need any modules

Pau Corbella 109 May 22, 2021
Generic AST parsing library for kotlin multiplatform

kotlinx.ast kotlinx.ast is a generic AST (Abstract Syntax Tree) parsing library, Kotlin is currently the only supported language. The library is desig

null 140 Jul 27, 2021
Koi, a lightweight kotlin library for Android Development.

Koi - A lightweight Kotlin library for Android Koi include many useful extensions and functions, they can help reducing the boilerplate code in Androi

Hello World 507 Jul 11, 2021
Gradle plugin for simplify Kotlin Multiplatform mobile configurations

Mobile Multiplatform gradle plugin This is a Gradle plugin for simple setup of Kotlin Multiplatform mobile Gradle modules. Setup buildSrc/build.gradle

IceRock Development 59 Jul 5, 2021