/kotlin-mpp-example

Example of Kotlin multiplatform project

Primary LanguageObjective-CApache License 2.0Apache-2.0

Multiplatform sample

This example shows how to use Kotlin/Native in the multiplatform world.

This sample based on the multiplatform documentation. If you have questions about the structure or how it works take a look at the documentation there.

iOS

To compile the project from Xcode just open iosApp/iosApp.xcodeproj and run the application. The swift tests also can be executed from Xcode.

To compile a framework for ios simulator from the command line execute:

  > ./gradlew :greeting:build

To compile the framework for a device use the device project property:

  > ./gradlew :greeting:build -Pdevice=true

To run kotlin tests (including the common ones) on an iOS simulator execute:

  > ./gradlew :greeting:iosSimTest

By default the iPhone 8 simulator is used. One can change this setting using the iosDevice project property:

  > ./gradlew :greeting:iosSimTest -PiosDevice='iPhone 7'

Android

The application can be built and executed on a device or emulator using Android Studio 3.2 or higher. One can also compile the application and run tests from the command line:

   > ./gradlew :androidApp:build