Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Kotlin Multiplatform in 2026: Complete Guide with Real-World Architecture, Kotlin Examples & Interview Questions

If you are an Android developer, you probably know Kotlin, Jetpack Compose, MVVM, Coroutines, Retrofit, Room, and modern Android architecture. But what if you need to build the same product for Android and iOS? Traditionally, teams maintain separate implementations: Kotlin for Android. Swift for iOS. Separate networking and data layers. Separate business rules and validation. Separate database…

Kotlin Multiplatform (KMP) is a technology that allows sharing Kotlin code across multiple platforms, including Android, iOS, desktop, and others. It helps in sharing business rules, networking, repository implementations, database access, validation, authentication workflows, and offline synchronization logic. The shared code can coexist with native Android UI using Jetpack Compose and native iOS UI with SwiftUI.

KMP can be used in two approaches - Option A, where shared business logic is used with native UI on each platform, or Option B, where shared UI is used along with common KMP logic. Alternatively, KMP can be compared to Flutter and React Native, where each has its unique features, primary languages, and UI options. The recommended production architecture for KMP involves four boundaries - Presentation, Domain, Data, and Platform Integration.

Each boundary has its responsibilities, such as screen state and user interaction, business rules, repository contracts, use cases, and platform-specific capabilities. Project structure for a starter project with shared modules and Compose application modules can be set up with specific source sets, such as commonMain, androidMain, and iosMain.

Kotlin's expect and actual declarations allow for platform-specific functionality within shared code.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Rotating session encryption keys without logging everyone out

Rotating session encryption keys without logging everyone out Session encryption keys are easy to forget because they often work silently.

  • OWASP guidelines outline key lifecycle management and cryptoperiods.
  • Inventory all key instances: session cookies, server-side records, cache values.
  • Verify-only deployment allows old and new keys to coexist during rotation.

We ran kubectl rollout undo twice to go back two versions and the second one restored the release we had just removed

Our label service runs as a Deployment, and for years our rollback has been kubectl rollout undo. The runbook said: if a release misbehaves, undo it first and investigate after.

  • Engineer rolled back version 4.17 using kubectl rollout undo twice
  • First undo restored version 4.16, second undo restored version 4.17
  • Rollback process should use version-specific script for clearer history

More from Thursday 26 November →