Kotlin logo

Kotlin

A concise multiplatform language developed by JetBrains

iOS Multiplatform Native

Kotlin/Native Support for AppCode 2019.1

We are happy to announce the new and improved Kotlin/Native plugin for AppCode 2019.1! Enjoy working on Kotlin, Swift, and Objective-C projects for macOS and iOS inside the same IDE. New to AppCode? AppCode is macOS-only IDE from JetBrains designed specifically for iOS/macOS developers. It offers extensive support for Objective-C and Swift.

To try the plugin out open AppCode 2019.1 (EAP or Release), navigate to Preferences | Plugins and type Kotlin/Native in the Marketplace tab search to find and install the Kotlin/Native for AppCode plugin

New Kotlin/Native Projects for iOS

The Kotlin/Native plugin for AppCode adds support for Kotlin/Native projects written in Gradle. For reusing code between iOS and Kotlin, we set up Kotlin/Native build to produce a framework which is used in Xcode. AppCode helps to configure an Xcode build for this scenario. We’ve added items to the New Project wizard to help us get started with a pre-configured project from scratch.

appcode2019.1-new-project-wizaed

The highlighted project template configures everything. It creates and binds Kotlin/Native Gradle project to an iOS Xcode project, so that the Xcode build will call the Kotlin/Native build automatically, with respect to the selected target. The project will then be ready to work in both Xcode (without Kotlin support) and AppCode.

If you already have an existing project, you can add the Kotlin/Native Framework target by opening the Project Settings dialog (⌘;), clicking on the (+) button in the list of targets, and then selecting the Kotlin/Native | Framework option.

Note that you will need to click on the Import Gradle project or Import Changes link in AppCode after the project is opened.

appcode2019.1-unlinked-gradle

The Open Gradle Project dialog will be shown. While the output of the compiler does not have any dependencies or virtual machine requirements, the compiler itself and the Gradle build system require the Java 1.8 or 11 runtime. Use the path to it to fill the Gradle JVM field. Check out the https://jdk.java.net/11 or https://adoptopenjdk.net/ for the best JRE, OpenJDK, or JDK distribution. By default on macOS, JVMs are installed to the /Library/Java/JavaVirtualMachines folder.

appcode2019.1-gradle-import

Kotlin/Native Gradle Projects Support

Writing Kotlin/Native code for iOS and macOS is now supported in AppCode too for Kotlin Multiplatform projects. Open your Gradle project from build.gradle or build.gradle.kts files or use the project wizard to create a new one.

Kotlin Language Support

Just to remind you, the Kotlin/Native plugin for AppCode includes Kotlin language support, similar to what you have in CLion and IntelliJ IDEA. For example, there is code completion and quick doc dialogs for macOS or iOS classes which are also accessible directly from Kotlin/Native

appcode2019.1-completion
appcode2019.1-quickdoc

Debugger support for Kotlin/Native, Swift, and Objective-C code is improved and included for applications running in an emulator, a device, or a macOS host

appcode2019.1-debugger

Conclusion

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

image description