Compose Multiplatform mobile application
- Android
- iOS
- Desktop (Windows, macOS, Linux)
Warning You need a Mac with macOS to write and run iOS-specific code on simulated or real devices. This is an Apple requirement.
To work with this template, you need the following:
- A machine running a recent version of macOS
- Xcode
- Android Studio
- The Kotlin Multiplatform Mobile plugin
- The CocoaPods dependency manager
Before you start, use the KDoctor tool to ensure that your development environment is configured correctly:
-
Install KDoctor with Homebrew:
brew install kdoctor
-
Run KDoctor in your terminal:
kdoctor
If everything is set up correctly, you'll see valid output:
Environment diagnose (to see all details, use -v option): [✓] Operation System [✓] Java [✓] Android Studio [✓] Xcode [✓] Cocoapods Conclusion: ✓ Your system is ready for Kotlin Multiplatform Mobile development!
Otherwise, KDoctor will highlight which parts of your setup still need to be configured and will suggest a way to fix them.
Compose Multiplatform project includes 4 modules:
This is a Kotlin module that contains the logic common for Android, iOS and Desktop applications, that is, the code you share between platforms.
This is a Kotlin module that builds into an Android application. It uses Gradle as the build system.
The androidApp
module depends on and uses the shared
module as a regular Android library.
This is an Xcode project that builds into an iOS application.
It depends on and uses the shared
module as a CocoaPods dependency.
This is a Desktop project that builds into a Desktop application.
The desktopApp
module depends on and uses the shared
module as a regular jvm library.
Run Gradle tasks :
./gradlew :desktopApp:run
to run the application./gradlew :desktopApp:createDistributable
to store native distribution intobuild/compose/binaries/main/app