Kotlin Multiplatform is here! 🙌
I'm going to give a talk at Droidcon Madrid about it:
👉 The Hitchhikers Guide Through Kotlin Multiplaform
This repository contains a demo of an application developed to show how we can have a shared logic module between two different targets - in this case, Android and iOS.
This is a multi-screen application that allows you to see the schedule, speakers and select all your favourite talks that are going to happen at Droidcon Madrid.
The application communicated with Sessionize API in order to fetch the schedule and speakers data; this will also be stored on a local database.
This way, common
contains all this logic needed and androidMain
and iosMain
are just responsible to ask for data to populate the views, in this case a RecyclerView and a UITableViewController accordingly.
- io.ktor:ktor-client-core
- io.ktor:ktor-client-serialization
- org.jetbrains.kotlinx:kotlinx-coroutines
- com.squareup.sqldelight
- Edit local.properties to contain the path to Android SDK
- Open the project with IntelliJ
- Select auto-import
Wait for project to sync.
Compile for Android:
- Go to "Add configuration" and select "Android App"
- Add a name to the configuration (for example "android")
- Select "app" module and click "OK"
Click on Run to compile and install it on your Android device
Compile for iOS
- Open the iosApp/iosApp.xcodeproj from Xcode
Click on Run to compile and install it on your iOS device
If you want to create your first project using Kotlin Multiplatform for Android and iOS you can find this medium post that I've writen here.
We're on the beginning of Kotlin Multiplatform, and there are already amazing projects out there that it take it a bit further, don't forget to give a look at: