What You Can and Cannot Share Yet
Realistic boundaries of code sharing in production KMP today.
What You Can and Cannot Share Yet is a free Kotlin Multiplatform Academy lesson on CoddyKit — lesson 4 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.
Know the Boundaries
KMP shares a lot, but not everything. Knowing the real boundaries keeps your expectations honest on a production team. 🧱
Share: Business Logic
Pure rules and calculations share beautifully. Your business logic has no platform ties, so it runs the same everywhere.
Share: Data Models
Your data models, the classes that describe a user or an order, are easy wins. Define them once and use them on every target.
data class User(
val id: String,
val name: String
)Share: Networking
HTTP calls and JSON parsing share well using multiplatform libraries. Your whole networking layer can live in shared code.
Share: Local Storage
Databases and key-value stores have multiplatform options too. So your storage layer is also a strong candidate for sharing.
Often Native: The UI
Most teams keep the UI native for the best feel. You can share it with Compose Multiplatform, but it stays a real choice.
Native: Platform Features
Camera, sensors, and OS dialogs differ per platform. These platform features need native code, often behind a shared interface.
The expect/actual Bridge
For things that differ per platform, KMP offers expect/actual. You declare a common API and give each platform its own version.
expect fun platformName(): StringSome Libraries Are JVM-Only
Not every Kotlin library is multiplatform. JVM-only libraries cannot go in common code, so check support before adding one.
A Healthy Default
A common starting line: share logic, data, and networking; keep UI native. Adjust the split as your team gains confidence.
It Keeps Improving
The KMP ecosystem grows fast, so what is shareable keeps expanding. More libraries go multiplatform every year.
Quick Check
Let's test the sharing boundaries.
Recap
Share logic, models, networking, and storage freely; keep UI and device features native. Use expect/actual to bridge the gaps. 🎉
Frequently asked questions
Is the “What You Can and Cannot Share Yet” lesson free?
Yes — the full text of “What You Can and Cannot Share Yet” 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 “What You Can and Cannot Share Yet”?
Realistic boundaries of code sharing in production KMP today. 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 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “What You Can and Cannot Share Yet” 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
- Share Logic, Not UI: The KMP Promise
- KMP vs Flutter vs React Native
- Targets: Android, iOS, Desktop, Web, Server
- What You Can and Cannot Share Yet