Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)

Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)

Márton Braun

April 23, 2024
Tweet

More Decks by Márton Braun

Other Decks in Programming

Transcript

  1. Agenda • What is Compose Multiplatform • Different targets &

    stability • Live Demo: From 0 to 100 with CMP • Interop and adoption • Quick ecosystem overview • What's next
  2. iOS APIs CoreBluetooth, Foundation, CoreData, … Android APIs android.bluetooth, Core

    Libraries, Room, … iOS-specific logic Android- specific logic UIKit widgets Jetpack Compose Android views Shared business logic with Kotlin Multiplatform SwiftUI
  3. iOS APIs CoreBluetooth, Foundation, CoreData, … Android APIs android.bluetooth, Core

    Libraries, Room, … iOS-specific logic Android- specific logic UIKit widgets Jetpack Compose Android views Shared business logic with Kotlin Multiplatform (opt.) SwiftUI
  4. iOS APIs CoreBluetooth, Foundation, CoreData, … Android APIs android.bluetooth, Core

    Libraries, Room, … iOS-specific logic Android- specific logic UIKit widgets Jetpack Compose Android views Shared business logic with Kotlin Multiplatform (opt.) SwiftUI
  5. iOS APIs CoreBluetooth, Foundation, CoreData, … Android APIs android.bluetooth, Core

    Libraries, Room, … iOS-specific logic Android- specific logic UIKit widgets (opt.) Android views Shared business logic with Kotlin Multiplatform Swift UI Shared UI with Compose Multiplatform
  6. Desktop JVM APIs File pickers, notifications, … Desktop- specific logic

    iOS APIs CoreBluetooth, Foundation, CoreData, … Android APIs android.bluetooth, Core Libraries, Room, … iOS-specific logic Android- specific logic Shared business logic with Kotlin Multiplatform Shared UI with Compose Multiplatform Android views UIKit widgets (opt.) Swift UI
  7. Demo recap ✅ Used multiplatform libraries Created a new project

    with the KMP wizard Automatically checked development setup with Project Preflight checks Built UI in Compose Multiplatform Deployed to iOS, Android and Desktop ✅ ✅ ✅ ✅
  8. Compose Multiplatform builds on Kotlin Multiplatform • Fully native on

    Android • Kotlin/Native binaries on iOS • No “magic switch” – transition takes work!
  9. expect fun getPlatform(): String actual fun getPlatform(): String = "Java

    ${System.getProperty("java.version")}" actual fun getPlatform(): String = "iOS ${UIDevice.currentDevice.systemVersion}" actual fun getPlatform(): String = "Android ${Build.VERSION.SDK_INT}"
  10. Compose Navigation • Making Jetpack Navigation component available in common

    code – Popular, well-established APIs – Minimizing the work for bringing existing Android apps to multiplatform 🧪
  11. Compose resources 🧑🔬 • Support for – values (strings) –

    drawable – font – files • Typesafe accessors via Res
  12. It’s your turn! • App developers: Go and try Compose

    Multiplatform on iOS, Android, Desktop and beyond! • Library developers: Support multiplatform! ❤