This is a Kotlin Multiplatform project targeting Android, Desktop, iOS (to be added).
-
/composeApp
contains the Compose Multiplatform code and is the starting point for targets. It contains several subfolders:commonMain
is 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,
androidMain
would be the right folder for such calls.
-
/common
contains all the common code and is a starting template for any modules that you may add to this project. -
/tooling
contains all the necessary tools you would need during build It contains the following:/checks
contains detekt configuration files/desktop
contains the icons needed for building an installer for desktop targets/proguard-config
contains proguard configuration files for both desktop and android/plugins
contains custom gradle convention plugins that simplify module configuration
-
/iosApp
contains 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:
ComposeMultiplatformAppPlugin
used to configure the main app modulecomposeApp
. It contains code for android setup, Compose Multiplatform and the necessary libraries already configuredComposeMultiplatformLibPlugin
used to configure all library sub-modules that will also contain Compose code Necessary libraries already installed too.KotlinMultiplatformLibPlugin
used to configure all library sub-modules. Configured forkoin
and basic Android core librariesDetektConventionPlugin
used to configuredetekt
code 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.name
to your Project name
Versions
inside/tooling/plugins/packages-name/extensions
- Edit the
PACKAGE_NAME
to your desired one. It is important that you change this
build.gradle.kts
inside/common
- Change android
namespace
to your own convention
/common/src
and/composeApp/src
package names
- You should change the package names inside each source folder. Eg.
work.racka.template
to 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.yml
contains code for runningdetekt
for code analysis. You can also set up other linters and unit tests inside this fileci-cd-pipeline.yml
contains 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_ALIAS
andKEY_PASSWORD
. Learn more about adding these keys from here and here
- See CONTRIBUTING
Learn more about Kotlin Multiplatform…