Ⓚ Kotlin/Native for iOS development

updated 10 months ago; latest suggestion 9 months ago

This proposal has been withdrawn...

Introduction

JetBrains, the company which developed IntelliJ IDEa, AppCode and other cool IDEs, also known as a founder of Kotlin programming language.
Kotlin has become a first class citizen programming language for Android development last year.
This is functional programming language, which is extremely similar to Swift in the concept and syntax.
This means, that Swift developers may read/write Kotlin code fairly easy, likewise in the opposite direction: Kotlin devs -> Swift code.

Kotlin/Native

JetBrains introduced recently another framework called Kotlin/Native.
Kotlin/Native is an LLVM backend for the Kotlin compiler, runtime implementation, and native code generation facility using the LLVM toolchain. It is primarily designed to allow compilation for platforms where virtual machines are not desirable or possible (such as iOS or embedded targets), or where a developer is willing to produce a reasonably-sized self-contained program without the need to ship an additional execution runtime.
In a nutshell, it allows to write code in Kotlin, which then can be compiled to iOS binary.
While writing iOS applications purely in Kotlin doesn't seem to be a nice idea, this possibility opens opportunity for sharing the business logic between iOS and Android applications in form of shared library written in Kotlin.
This is not really multiplatform development tool, but it allows you to place the common business logic into one codebase, and then share it in form of native library between platform-specific applications (iOS and Android particularly). Advantages of the shared codebase are obvious: less code, faster development, easier to maintain. Also, common codebase for business logic entails common set of unit tests for it.

About me

I'm an iOS developer with 10 years of experience. During last year I'm working on an Android Wear (smartwatch) project as a Team Lead. Our project has Android and iOS streams, and we seek for some cross-platform approaches, which allow to share some codebase between platforms, while remaining applications developed with native tools.

Agenda

  • Kotlin vs Swift. What's in common
  • What is Kotlin-native
  • How to make iOS framework implemented in Kotlin
  • Sample of the application for iOS and Android, with shared library in Kotlin.
  • Nice&ugly things around development in Kotlin for iOS.

Suggestions

  • Ed8b3fcf16c3bf26d8e604113849c7b940bd36a0?size=100x100 ed8b3fcf16c3bf26d8e604113849c7b940bd36a0 suggests 9 months ago

    Great idea! I'd love to hear about your experiences with Kotlin/Native and whether the approach to use it for a common business logic layer is really applicable for large commercial projects already. How do you embed these libraries in your Xcode project?