Albert-Gao / kotlin-native-mobile-multiplatform-example

Code sharing between iOS and Android with Kotlin native
52 stars 7 forks source link
android android-studio boilerplate code-sharing gradle ios kotlin native template xcode

Kotlin Native mobile multiplatform example

There is a cross more platforms version (added JVM and JS) in this repo

Read my blog if you want more details:

Overview

This is an example of using Kotlin native to share the code between iOS and Android. It contains the tests for all the platform code. Setup via the support from multiplatform kotlin.

This setup is aiming to solve the problem, where we want to write the platform specific code in a multiplatform manner.

Folders

Workflow:

In fact, you can edit the sharing code in android studio as well, as we embed them as module, and they all use the same language.

About the example

Tips

If you think the XCode building phase is slow. That is because it will build the KN generated iOS framework every time. You can modify it by just copying the framework files without building it. Because you can always edit Kotlin native code somewhere else.