Useless facts every day!
Here's an example of a multiplatform app with shared UI and network logic built with Kotlin Multiplatform Mobile and Compose Multiplatform for Android, iOS and Desktop.
Android (Dark theme) | iOS (Light theme) |
---|---|
Desktop |
---|
- Kotlin Multiplatform Mobile
- Compose Multiplatform
- Kotlin Coroutines
- Kotlin Serialization
- Ktor
- Napier
The project follows the Kotlin Multiplatform structure, allowing code sharing between Android and iOS platforms. Here's a brief overview of the project structure:
shared
: Contains shared Kotlin code that is used by both Android and iOS.androidApp
: Contains the Android-specific code, including activities, UI components, and Android-specific dependencies.iosApp
: Contains the iOS-specific code, including view controllers, SwiftUI views, and iOS-specific dependencies.desktop
: Contains the desktop-specific code for the Kotlin Multiplatform project, targeting desktop platforms such as Windows, macOS, and Linux.
- Open
androidApp
folder from Android Studio - Click Run
- Open
iosApp/iosApp.xcodeproj
folder from Xcode - Click Run
- Open the project from Android Studio
- Execute the command
./gradle :desktop:run
to run the desktop module.
Since IntelliJ IDEA currently does not support Gradle versions above 7.4.0, follow these steps to address the issue:
- In the gradle.properties file, temporarily change the Gradle plugin version to 7.4.0.
- In the settings.gradle.kts file, disable the inclusion of (":androidApp").
This project is licensed under the MIT License.