This is an example project to test the possibilities of the Kotlin multiplatform technology. It takes a name, birthday and gender and calculate a random monthly insurance cost. It targets android, iOS and web.
Feel free to try it yourself https://compeople.github.io/kotlin-multiplatform-sample/
If you don't have an android sdk, you can build the application without it, using: ./gradlew build -PskipAndroid
.
- make sure you have an Android SDK installed
- Open the project
- create and add a file
local.properties
in the root directory of the project:
sdk.dir=yourLocalPathToAndroidSdk
- look under TODOs and change the url for the server call in
kotlin-multiplatform-sample/commonClient/src/commonMain/kotlin/de.compeople.swn/tarifService/TarifClient
- Run
./gradlew build
- start the server with:
./gradlew :server:run
run : :server:build -PskipAndroid
- Create a run configuration of type "Android App"
- Select module "app" in the run configuration settings
- run the configuration
- start the server with:
./gradlew :server:run
- Open the XCode project under
native
- Run it as normal
- build the website with:
./gradlew :web:build
- start with:
./gradlew :web:webpack-run
First you have to adjust the url for the server call:
look under TODOs and change the url for the server call in
kotlin-multiplatform-sample/commonClient/src/commonTest/kotlin/test.de.compeople.swn/tarifService/TarifClientTest
There a Tests in the common and the commonClient module. To run the Test use:
kotlin-multiplatform-sample:common:check
kotlin-multiplatform-sample:commonClient:check
At the moment the tests for js are disabled, because mockk for JS is not ready yet for coroutines.
- Gradle - Dependency Management
- Ktor
- kotlin-Wrappers - kotlin-react, kotlin-react-com for the web
- mockK - mocking library
This project is licensed under the MIT License