mailwal

Kotlin Multiplatform Newsletter #41

commonMain.dev

Kotlin 2.4.x introduces built-in SwiftPM imports for seamless iOS SDK integration, sub-millisecond input latency on 100k-line files using Skia and rope data structures with Kortex and Krope, and strategies for flake-free Coroutine Flow testing. We also cover centralizing error handling across OkHttp, NSURLSession, and Ktor in commonMain, designing mobile architectures optimized for both humans and AI agents, and morphing FABs into dialogs in Compose UI. Plus, a Senior Software Engineer opening at Fanatics.

The Main Thread

Community's most insightful threads, curated from social media platforms and websites.

[Reddit] For those on the fence on whether to use CMP, I'd say don't worry about it

Had some dilemma for CMP though, I'm very fond of compose and definitely great if we can share compose UI across Android and iOS, however I read articles on how iOS users would always prefer the native iOS feel and they would not like Compose built UI, so got a little bit worried.

Expect Actual

Technical deep dives, or solving the "how-the-hell-do-I-test-this" problems.

affiliate link

Stop treating Kotlin like a black box! 🧠

To build truly performant multiplatform apps, writing code that just "works" isn't enough. We need to understand what the compiler is actually doing under the hood.

That’s why I highly recommend Practical Kotlin Deep Dive by skydoves. This isn't a basic syntax guide, it breaks down Kotlin internals, bytecode, and coroutines. It’s been a total game-changer for me when writing and optimizing shared code.

If you want to level up your Kotlin and KMP skills to a senior standard, you need this on your desk.

Hardening Coroutine Tests: Flake-Free Flow Tests in Kotlin

Testing flows in your app can be confusing, especially when they’re interconnected with multiple data sources and emissions coming from multiple places. In this multi-part series we’ll cover how to effectively test flows and avoid flakiness in your coroutine testing.
Centralised Network and API Error Handling in Kotlin Multiplatform

Centralised Error handling looks insignificant until you have three platforms, multiple networking engines, and a growing pile of catch (e: Exception) blocks scattered across the codebase. In a Kotlin Multiplatform (KMP) project, the problem gets sharper: shared commonMain code needs one predictable way to represent "something went wrong", regardless of whether the underlying failure came from OkHttp on Android, NSURLSession on iOS, or Ktor.
KMP and AI: Designing a Mobile Architecture that is readable by Humans and Agents

In the age of AI, a cross-platform architecture does more than just share code across operating systems. It also creates a common interface of understanding for humans and agents.
Swift packages in Kotlin Multiplatform — built-in SwiftPM import with Kotlin 2.4.x

Google Nearby Connections is a good example. Its iOS SDK is distributed as a Swift package, but downloading and compiling it doesn’t necessarily mean that its APIs will be accessible from Kotlin. There are a few additional pieces involved, and Kotlin 2.4.0 made the configuration easier thanks to built-in SwiftPM import.
The Evolution of Statics: Say Goodbye to Kotlin Companion Objects?

For years, we used companion object to group class-level members (constants, factory methods). However, companion objects are actual object singletons under the hood. This introduces memory overhead and causes friction when interoperating with Java (requiring @JvmStaticannotations).

LazyColumn

Compose Multiplatform tips, tricks, and code snippets.

Morphing a Floating Action Button into a Dialog in Compose Multiplatform

When a floating action button kicks off an action that requires a paid plan, such as when free users hit their binder limit in Sleevd, we show an alert dialog to prompt the user to upgrade. In most apps, this dialog fades in at the centre of the screen with no connection to the button that was tapped. While this works and is a standard approach, the button and the dialog feel like two unrelated components, and the user’s eye has to jump from the corner of the screen to the middle.
Reaching sub-millisecond input latency on 100K-line files using Kotlin Multiplatform, Skia, and Virtualized canvas layers

Declarative UI frameworks excel at forms, chat inputs, and short documents. However, the moment you load a 50,000-line source file, attach real-time syntax highlighting, spawn multiple cursors, and scroll rapidly at 120Hz, the standard composable pipeline starts gasping for air. Recreating AnnotatedString instances on every keystroke, measuring thousands of nested layout nodes, and allocating objects on the hot rendering path inevitably leads to garbage collection pauses and dropped frames.

The Dependency Graph

Curated libraries, tools and plugins that won't break your Gradle build.

  • Crayfish
    Compose Multiplatform image cropper for Android, iOS, desktop, and the web.
  • LazySurface
    Build 2D surfaces where items say who they sit next to, not where they are. Lazy, on every Compose platform.
  • TestBalloon
    A DSL-based Kotlin-first test framework. It lets you configure tests with plain Kotlin instead of restrictive, annotation-based magic. TestBalloon's concise API is extremely flexible and easy to customize for any test setup.
  • Kortex
    Ultra-fast, hardware-accelerated code and plain-text editor for Compose Multiplatform (Desktop, Android, iOS, Wasm). Skia canvas, Krope rope buffer, MVI reducers. Multi-cursor, syntax highlighting, diagnostics, hover docs, completion, folding.
  • Krope
    A high-performance, immutable text buffer for Kotlin Multiplatform, powered by a balanced Rope data structure. Designed for collaborative editors, IDEs, and reactive text processing, it delivers O(log N) insertions/deletions with structural sharing to minimize memory overhead. Features include reactive coroutine-based event streams, multi-encoding.
  • KMP Translations Hub
    A free plugin for Android Studio and IntelliJ IDEA that makes composeResources translations easier to manage.

Target: Production

Showcase of real-world apps proving KMP is ready for prime time.

SPONSORED

wellfound • Where great companies meet great people.

The next company that changes the world, and the role that changes yours. Wellfound is where 27,000+ startups hire. Apply directly to the founders and hiring managers building what's next.

Careers

Kotlin Multiplatform job postings and opportunities.

affiliate link

hackajob • Meet Archer, your AI job matching agent

5x more interviews. Zero guesswork. Archer works 24/7 to match you with roles that fit your stack and seniority. You review the matches, not the job boards.

Senior Software Engineer - Mobile at Fanatics
New York, NY, United States - Remote

As a Senior Software Engineer - Mobile at Fanatics Betting & Gaming (FBG), you'll be joining our dynamic mobile engineering teams, contributing to the rapidly growing Fanatics Sportsbook app ecosystem. You'll work across various product areas, developing features that enhance customer experience and drive business growth.
🚀 Get Featured!

Got something interesting to share with the Kotlin Multiplatform community? Submit your link for a chance to get featured in the next issue of commonMain.dev.

🤝 Support the Build

commonMain.dev is made possible by our partners. If you have a tool or service that helps KMP developers ship to production faster, we’d love to help you reach our community. Collaborate with us.

✍ Code Review

This newsletter is curated and written by a real human being. I’m always looking for ways to optimize the build. Was there something you liked or disliked in particular? Or did you find a bug in this issue? Simply reply to this email - I read every comment from the community and take your feedback into account for the next release.

Until next time,
Stay platform-independent!
Bogdan • Founder of commonMain.dev

commonMain.dev is not affiliated with JetBrains or the Kotlin Foundation.
Kodee by JetBrains s.r.o. is licensed under CC BY 4.0.