This is a Kotlin Multiplatform project targeting Android, Desktop, iOS (to be added).
-
/composeAppcontains the Compose Multiplatform code and is the starting point for targets. It contains several subfolders:commonMainis for code that’s common for all targets.- Other folders are for Kotlin code that will be compiled for only the platform indicated in the
folder name.
For example, if you want to use Android Context for the Android parts of your Kotlin app,
androidMainwould be the right folder for such calls.
-
/commoncontains all the common code and is a starting template for any modules that you may add to this project. -
/toolingcontains all the necessary tools you would need during build It contains the following:/checkscontains detekt configuration files/desktopcontains the icons needed for building an installer for desktop targets/proguard-configcontains proguard configuration files for both desktop and android/pluginscontains custom gradle convention plugins that simplify module configuration
-
/iosAppcontains iOS applications. Even if you’re sharing your UI with Compose Multiplatform, you need this entry point for your iOS app. This is also where you should add SwiftUI code for your project. It needs to be set up for use.
This contains all the code for the custom plugins used in this project.
These plugins help with build.gradle.kts boilerplate code that can be annoying to configure
Their uses are as follows:
ComposeMultiplatformAppPluginused to configure the main app modulecomposeApp. It contains code for android setup, Compose Multiplatform and the necessary libraries already configuredComposeMultiplatformLibPluginused to configure all library sub-modules that will also contain Compose code Necessary libraries already installed too.KotlinMultiplatformLibPluginused to configure all library sub-modules. Configured forkoinand basic Android core librariesDetektConventionPluginused to configuredetektcode analysis in the project levelbuild.gradle.kts
To run detekt for code analysis and formatting you use the command ./gradlew detekt
or gradle detekt
There are couple of names you need to change to conform with your own project.
- Project level
settings.gradle.kts
- Rename
rootProject.nameto your Project name
Versionsinside/tooling/plugins/packages-name/extensions
- Edit the
PACKAGE_NAMEto your desired one. It is important that you change this
build.gradle.ktsinside/common
- Change android
namespaceto your own convention
/common/srcand/composeApp/srcpackage names
- You should change the package names inside each source folder. Eg.
work.racka.templateto something of your own - You should use the Refactor tool of the IDE so the changes are applied everywhere necessary
This project contains Github Actions set up in /.github/workflows
code-check-pipeline.ymlcontains code for runningdetektfor code analysis. You can also set up other linters and unit tests inside this fileci-cd-pipeline.ymlcontains code for CI/CD integrations. You make sure you have provided the required secrets for the signing stage of the Android app. The secrets needed includeKEYSTORE_FILE,KEYSTORE_PASSWORD,KEY_ALIASandKEY_PASSWORD. Learn more about adding these keys from here and here
- See CONTRIBUTING
Learn more about Kotlin Multiplatform…