Coder Social home page Coder Social logo

kotlin-multuplatform-including-mobile's Introduction

Kotlin multi-platform boilerplate including mobile

There is a mobile only version 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

  • android: Android project built by Android Studio
  • ios: iOS Project built by XCode
  • jvmApp: jvm app which consumes the lib
  • jsApp: js app on how to consume the lib
  • common: The shared code that is meant to be across all platforms without any change.
  • platforms: platform specific implementation which will be compiled with common
    • ios: it will be compiled as an iOS framework
    • js
    • jvm: a dependency for both android app and jvmApp

Workflow:

  • Work on Android App: Open Android folder in Android Studio
  • Work on iOS App: Open iOS folder in XCode
  • Work on sharing code: Open the root folder in IDEA or any other IDE.

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

  • Sample class is for code that is sharing across platforms (Which means you only use API from kotlin-stdlib-common or some other cross platform lib).

  • Platform class is a class which has been implemented twice for different platforms for showing the platform API case.

  • Open Android folder in Android Studio, run the app, it will show a string from the :shared-android

  • Open iOS folder in XCode, run the app, it will show a string from the :shared-ios

  • And the string is from both platforms are retrieved from the Sample class.

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.

kotlin-multuplatform-including-mobile's People

Contributors

albert-gao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jamie-codez

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.