<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Rafał Gawlik</title>
    <description>The latest articles on Forem by Rafał Gawlik (@rafalgawlik).</description>
    <link>https://forem.com/rafalgawlik</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F388105%2F82c1365b-7deb-488c-899f-d3799319aef8.jpg</url>
      <title>Forem: Rafał Gawlik</title>
      <link>https://forem.com/rafalgawlik</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/rafalgawlik"/>
    <language>en</language>
    <item>
      <title>Kotlin Multiplatform in Production - 1 Year Later</title>
      <dc:creator>Rafał Gawlik</dc:creator>
      <pubDate>Tue, 13 Jan 2026 18:08:51 +0000</pubDate>
      <link>https://forem.com/rafalgawlik/kotlin-multiplatform-in-production-1-year-later-55po</link>
      <guid>https://forem.com/rafalgawlik/kotlin-multiplatform-in-production-1-year-later-55po</guid>
      <description>&lt;p&gt;A year ago, we started migrating a large Polish e-commerce app to Kotlin Multiplatform. Here's what actually happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Setup
&lt;/h2&gt;

&lt;p&gt;The app serves millions of users. Before KMP, we had two separate codebases - native Android (Kotlin) and native iOS (Swift). The usual story: duplicated business logic, bugs fixed on one platform but not the other, two teams working in parallel on identical problems.&lt;/p&gt;

&lt;p&gt;KMP promised to fix this. Did it?&lt;/p&gt;

&lt;h2&gt;
  
  
  What We Shared (And What We Didn't)
&lt;/h2&gt;

&lt;p&gt;We went with a layered architecture approach rather than feature-based modules. This turned out to be the right call.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shared code (KMP):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Domain layer (business logic, use cases)&lt;/li&gt;
&lt;li&gt;Repositories&lt;/li&gt;
&lt;li&gt;Networking&lt;/li&gt;
&lt;li&gt;Local database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Stayed native:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ViewModels&lt;/li&gt;
&lt;li&gt;UI (Compose on Android, SwiftUI on iOS)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This split felt natural. The domain layer is where the real duplication pain was. UI differences between platforms are legitimate - users expect platform-native behavior.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Firebase Problem
&lt;/h2&gt;

&lt;p&gt;This one caught us off guard.&lt;/p&gt;

&lt;p&gt;Firebase SDK is platform-specific. But our shared domain layer needed Crashlytics for error tracking and Analytics for business events. The solution: dependency injection using Kotlin's &lt;code&gt;expect&lt;/code&gt;/&lt;code&gt;actual&lt;/code&gt; mechanism.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="c1"&gt;// In shared code&lt;/span&gt;
&lt;span class="n"&gt;expect&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AnalyticsTracker&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;logEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Map&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Any&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Platform creates Firebase instance natively, &lt;/span&gt;
&lt;span class="c1"&gt;// then injects it into shared core&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It works, but it's not pretty. Every Firebase feature you want in shared code requires this dance. If I were starting today, I'd think harder about what truly needs to be in the shared layer vs. what can stay platform-specific.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build Times: The Good News
&lt;/h2&gt;

&lt;p&gt;I expected build times to explode. They didn't.&lt;/p&gt;

&lt;p&gt;The Kotlin compiler has gotten significantly better. Our incremental builds are reasonable. Full rebuilds take longer, sure, but not dramatically worse than before.&lt;/p&gt;

&lt;p&gt;This was a pleasant surprise.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Two-IDE Reality
&lt;/h2&gt;

&lt;p&gt;Here's something nobody warns you about: your iOS developers will live in two IDEs.&lt;/p&gt;

&lt;p&gt;They need Xcode for iOS-specific code, debugging, and running the app. But for shared Kotlin code, Android Studio (or Fleet) is significantly better. Syntax highlighting, autocomplete, refactoring - it all works better in JetBrains tools.&lt;/p&gt;

&lt;p&gt;Some of our iOS devs resisted this at first. Eventually, everyone adapted. But factor this into your onboarding time.&lt;/p&gt;

&lt;h2&gt;
  
  
  CI/CD Gets Complicated
&lt;/h2&gt;

&lt;p&gt;Our CI pipeline needed serious rework.&lt;/p&gt;

&lt;p&gt;The shared KMP module is its own thing now. iOS and Android apps depend on it. We ended up using Git submodules to manage this - the shared code lives in a separate repo, and both platform repos reference it.&lt;/p&gt;

&lt;p&gt;This adds complexity:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PRs that touch shared code need coordinated merges&lt;/li&gt;
&lt;li&gt;Version pinning becomes important&lt;/li&gt;
&lt;li&gt;Your CI needs to understand these dependencies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Not insurmountable, but definitely more moving parts than two independent native apps.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Biggest Regret
&lt;/h2&gt;

&lt;p&gt;We should have written more unit tests for shared code from day one.&lt;/p&gt;

&lt;p&gt;When your business logic lives in one place, a bug affects both platforms simultaneously. That's the flip side of "fix once, fixed everywhere." Before KMP, a logic bug might only hit Android users. Now it hits everyone.&lt;/p&gt;

&lt;p&gt;Shared code deserves higher test coverage than platform-specific code. We learned this the hard way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Would I Choose KMP Again?
&lt;/h2&gt;

&lt;p&gt;Yes.&lt;/p&gt;

&lt;p&gt;The promise is real: write your domain logic once, use it everywhere. After a year, we have genuinely less code duplication and fewer "fixed on Android but not iOS" bugs.&lt;/p&gt;

&lt;p&gt;But go in with realistic expectations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Architecture matters more than ever. Layer-based modularization worked better for us than feature-based.&lt;/li&gt;
&lt;li&gt;Platform boundaries are real. Don't try to share UI or fight platform-specific SDKs.&lt;/li&gt;
&lt;li&gt;Testing discipline is non-negotiable.&lt;/li&gt;
&lt;li&gt;Your iOS team needs to get comfortable with Kotlin and JetBrains tooling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;KMP is production-ready. It's not magic. It's a tool that works if you respect its constraints.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm a mobile developer specializing in Android, iOS, and Kotlin Multiplatform. Currently helping startups build cross-platform apps at &lt;a href="https://mobile.dev-node.com" rel="noopener noreferrer"&gt;MobileDev Node&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>kotlin</category>
      <category>mobile</category>
      <category>android</category>
      <category>ios</category>
    </item>
  </channel>
</rss>
