Kotlin Multiplatform is here! 🙌
A Multiplatform Triathlon is a project built using Kotlin Multiplatform and targeting:
- Android
- iOS
- Web
👉 Source Code
👉 Presentation
There are a couple of options here depending on your own preference. Recently, after KMM plugin was released to Android Studio I've changed my setup to:
- Android Studio 4.1 with KMM plugin.
- Xcode 11.7.
You can also use AppCode instead of Xcode or Intellij IDEA instead of Android Studio.
On Mac is really simple to install CocoaPods, just open the terminal and execute the following command:
sudo gem install cocoapods
Now that you've got your environment ready, it's time to compile the project! Don't forget to download:
- Clone the project locally
git clone https://github.com/cmota/kmp-a-multiplatform-triathlon.git
-
Now open Starter Project on Android Studio (with KMM plugin installed).
-
You'll need to wait until gradle runs all the tasks. You can get up and stretch your legs a bit, this is going to take some minutes.
-
Compile and run the app.
- Clone the project locally
git clone https://github.com/cmota/kmp-a-multiplatform-triathlon.git
-
Now open Starter Project on Android Studio (with KMM plugin installed).
-
You'll need to wait until gradle runs all the tasks. You can get up and stretch your legs a bit, this is going to take some minutes.
-
Compile and run the app.
-
Now it's to compile for iOS! First, go to the iosApp inside the Starter Project folder on the command line.
cd kmp-a-multiplatform-triathlon/
cd Starter\ Project/
cd iosApp
- Enter pod install to install all the of its dependencies
pod install
- Now that everything is installed let's open the iosApp.xcworkspace with Xcode.
Note: There are two project files inside the iosApp folder. It's easier to distinguish by the icon, the one that you need to open is the one that is white (extension .xcworkspace).
- Now click on compile and run and let's see the app running on the iOS simulator/ iPhone!
- To compile for the web just enter the following command on terminal:
./gradlew web:run --continuous
I've created a codelab where you can follow step by step the development of android and iOS application using Kotlin Multiplatform:
👉 Codelab
👉 Source Code
👉 Presentation