Kotlin/Native Plugin for AppCode

Greetings Kotlin fans!

Ever since we announced interoperability with Objective-C for Kotlin/Native, we’ve been getting lots of questions about IDE support that would allow working on projects that mix Kotlin/Native and Swift/Objective-C. Today we are happy to announce that we are working on a Kotlin/Native plugin for AppCode!

AppCode is our macOS-only IDE designed for iOS/macOS developers. It already supports the Xcode project model, running and debugging in simulators and on devices, and offers extensive support for Objective-C and Swift. So, it felt natural to add Kotlin/Native support to the mix.

To try out Kotlin/Native support, download AppCode 2018.1.1, then navigate to Preferences | Plugins | Install JetBrains Plugin and install the Kotlin/Native for AppCode plugin. Please keep in mind that both Kotlin/Native and the plugin for AppCode are still under active development. They are being published as a sneak peek of what’s coming and not suitable for production use yet. In particular, the list of known issues includes high memory consumption and only initial debugger support.

Creating New Project

Kotlin/Native uses Gradle as a build tool. To make a project with Kotlin/Native compilable from Xcode, you need to add to the project a Run Script phase that invokes building of Kotlin/Native code with Gradle. Setting up a project like that from scratch can be a bit tricky, so the Kotlin/Native plugin comes with several iOS and macOS templates which simplify this process:

create_project@2x

After the project has been created, building & launching it in the simulator is as easy as hitting the Run button:

run@2x

*Note: Currently the directory with Kotlin code is not marked as a source root, so some actions (e.g. New Kotlin File/Class) might work incorrectly. To fix that, navigate to the Project tool window, select Files pane, find the src/main/kotlin directory and mark it as Project Sources using context menu.

Code Insight

Like the plugin for CLion, this plugin for AppCode is based on the Kotlin plugin for IntelliJ IDEA, which means that lots of code-insight features are already available for Kotlin/Native code. These include code inspections, refactorings and many more:

assist@2x

Testing

The AppCode plugin supports running tests written using the kotlin.test framework. To create a test, navigate to Projects Settings and add a Tests target from the Kotlin/Native group. Then create a Kotlin/Native test run configuration and you are good to go:

tests@2x

SDK Documentation

One of the things that makes Kotlin/Native so appealing is its interoperability, which makes it very easy to use existing Objective-C API provided by Apple. The Kotlin/Native plugin for AppCode makes it even easier by giving you access to the documentation for these API right in the IDE:

doc@2x

Conclusion

This is all the functionality that we have to share with you at the moment. Give it a try, let us know what you think, and stay tuned for more exciting features as we continue our work on Kotlin/Native!

This entry was posted in iOS, Native, Releases, Tools and tagged . Bookmark the permalink.

13 Responses to Kotlin/Native Plugin for AppCode

  1. Louis CAD says:

    Good job! Can’t wait to see it improve further, and to see a multiplatform project with shared code among an Android app, a website in Kotlin/JS and maybe more like desktop support.

  2. Max says:

    OMG its awesome, hate swift go go Kotlin!!

  3. Ziga says:

    How can you link storyboard with the View Controller?

    • Vyacheslav Karpukhin says:

      Since it’s impossible to extend Xcode’s Interface Builder, the only way at the moment is to edit the storyboard’s XML manually, unfortunately.

  4. Juan says:

    Awesome! Too bad gradle was chosen as the official build tool. Yes, gradle is everywhere (like wordpress), but it’s a mess (like wordpress) that nobody can really understand and where plugins can do anything they want.

  5. SwiftyWang says:

    is it beta version or official release version?

  6. Anthony Nata says:

    This is an incredible news to some of us who who want to learn one language that caters a cross all platform.

    Started already

  7. jack says:

    I want to Know how “mark it as Project Sources using context menu”?

  8. Zander says:

    Where can I find the code used in the article?

  9. theapache64 says:

    AmaFuckingZing!

    For now, editing storyboard manuallly/using XCode is the only minus thing. Please make it possible through AppCode itself jetbrains. pleaaaaaseee..i knw you people are born to do the impossible. 😀 Please make it possible. Anyways, mind blowing work. Keep kotlin up!! 😀

    Peace

Comments are closed.