Search code examples
kotlin-multiplatformcompose-multiplatform

What is the difference between Kotlin and Compose?


I started studying kotlin and came across a lot of questions that I can't find: what is the difference between kotlin multiplatform and compose multiplatform? can they work together in the same project? what is more primary?

All I understood from the official documentation is that kotlin multiplatform is a framework for development on a variety of systems and compose multiplatform is an adaptation of compose from android


Solution

  • Kotlin Multiplatform is a language definition and set of tools that lets you write Kotlin and compile it to a wide range of platforms: JVM/Android, JS, iOS, Macos, Windows, Linux, etc (WASM in progress). It is agnostic about what you do with it. Also, some code can be compiled for all targets (common Kotlin), and some is platform-specific.

    Compose UI is a library for writing UI's. The vast majority of effort and the only really "production ready" implementation is for Android. However, compose for Desktop running on the JVM is being used by many teams. Compose UI for web exists, although I'm not sure how much use that gets. Compose for iOS is in the works. We published an app with it recently (https://touchlab.co/droidcon-nyc-ios-app-with-compose/), but I wouldn't use it for a production project yet, but in the not-too-distant future potentially.

    All of the non-android platforms use Kotlin Multiplatform to build Compose UI. It's sort of like SwiftUI uses Swift. They're related, but Swift is it's own, much more mature, thing.