How borealnetwork/kmmui works
Project type and purpose
• This is a Kotlin Multiplatform Mobile project that shares business logic and UI code across Android and iOS.
• The goal is to write common Compose UI and Kotlin code once (in the composeApp module) and then ship it as an Android app (using Jetpack Compose) and as an iOS app (wrapping the shared code in a SwiftUI/Xcode entry point).
File structure
• Top-level modules:
• composeApp/ – a Gradle-based Kotlin Multiplatform library and Android app module.
• iosApp/ – an Xcode project for the iOS application.
• Inside composeApp/:
• src/commonMain/ – shared Kotlin code and Compose Multiplatform UI (App.kt, Greeting.kt).
• src/androidMain/ – Android-specific code (MainActivity.kt, Platform.android.kt, Android resources).
• src/iosMain/ – iOS-specific Kotlin/Native glue (MainViewController.kt, Platform.ios.kt).
• src/commonTest/ – shared unit tests.
• The iosApp/ directory contains the SwiftUI entry point (ContentView.swift, iOSApp.swift) and assets, linking in the KMM framework produced by the Gradle build of composeApp.
README for additional insights
• Confirms the division between commonMain (shared code) and platform-specific sources.
• Describes how to build the Android app via Gradle and the iOS app via Xcode.
• Mentions Compose Multiplatform and that you may add native platform calls in androidMain or iosMain.
Detail
• Every source set as its own component if it has unique responsibilities (commonMain, androidMain, iosMain).
• Testing module (commonTest) to reflect the test layer.
• Don’t forget resources: Compose resources and Android/iOS asset catalogs.
• External systems only if they’re in scope (none here beyond platform SDKs).