0Pricing
Kotlin Multiplatform Academy · Lesson

The shared Module vs the App Modules

How the shared library plugs into Android and iOS apps.

The shared Module vs the App Modules is a free Kotlin Multiplatform Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Kotlin Multiplatform Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Two Apps, One Brain

A KMP project has two app modules plus one shared module. The shared module is the brain both apps borrow from. 🧠

What the shared Module Is

The shared module is a Kotlin library, not an app. It holds logic you want to write once and reuse on Android and iOS.

The androidApp Module

The androidApp module is a normal Android app. It depends on shared and adds Android-only UI and resources on top.

The iosApp Module

The iosApp is an Xcode project. It links a framework built from shared and presents the native iOS screens.

Dependency Flows One Way

The apps depend on shared, never the reverse. Shared code stays portable because it knows nothing about either app.

How Android Plugs In

Android wires shared in with a simple Gradle dependency. Once added, every shared class is importable in Kotlin.

dependencies {
    implementation(project(":shared"))
}

How iOS Plugs In

iOS does not use Gradle directly. Instead it imports a generated framework and calls your Kotlin from Swift.

import shared

let greeting = Greeting().greet()

Why Split It This Way

Splitting apps from shared keeps a clear boundary: business logic in one place, platform UI in its own home.

What Goes Where

Rule of thumb: logic, models and rules go in shared; screens, navigation and platform widgets stay in each app.

The shared Module Has Its Own Build

The shared module owns a build.gradle.kts that lists its targets. Each app also keeps its own build file.

Many Apps, Same Module

The same shared module can also feed a desktop or web app later. One library, many front ends. 🚀

Quick Check

Let us check how the modules relate.

Recap

You met the trio: one shared brain plus an androidApp and an iosApp that depend on it. Logic in shared, UI in the apps.

Frequently asked questions

Is the “The shared Module vs the App Modules” lesson free?

Yes — the full text of “The shared Module vs the App Modules” is free to read here on the web, and the Kotlin Multiplatform Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Kotlin Multiplatform Academy course, upgrade to CoddyKit PRO.

What will I learn in “The shared Module vs the App Modules”?

How the shared library plugs into Android and iOS apps. You practise Kotlin Multiplatform Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Kotlin Multiplatform Academy?

No prior experience is required. Kotlin Multiplatform Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “The shared Module vs the App Modules” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Kotlin Multiplatform Academy lesson?

Yes. Every Kotlin Multiplatform Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. The shared Module vs the App Modules
  2. commonMain, androidMain & iosMain
  3. Reading the shared build.gradle.kts
  4. Where Tests Live: commonTest & Friends
← Back to Kotlin Multiplatform Academy