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

Get started with Compose Multiplatform!

OG1
June 22, 2024

Get started with Compose Multiplatform!

OG1

June 22, 2024
Tweet

More Decks by OG1

Other Decks in Programming

Transcript

  1. ຊηογϣϯʹ͍ͭͯ ຊηογϣϯͷ಺༰ • Compose Multiplatformʹ͍͓ͭͯ͞Β͍ • UI࣮૷࣌ͷͭ·͖ͣϙΠϯτղઆ • ΩϟονΞοϓ্͍ͯ͘͠ͰͷTipsͷ͝঺հ ໨ඪ

    • UIͷڞ༗ʹ͍ͭͯͲͷΑ͏ͳࣄ͕ग़དྷΔ͔ௐࠪͷΩοΧέͱͳΔ • ࣮ࡍʹCompose MultiplatformͰ࣮૷͢Δࡍͷ଍ֻ͔ΓͱͳΔ
  2. Compose Multiplatformͱ͸ Kotlin Multiplatform Logic Compose Multiplatform UI Kotlin Multiplatform

    iOS Native UI Android Native UI ରԠϓϥοτϑΥʔϜ Bata iOS Android Stable Desktop Stable Web Alpha
  3. >؀ڥߏங • Android Studio • Kotlin Multiplatform Mobile plugin •

    Xcode • JDK • Kotlin plugin username@YourMacbook YourAppProject % kdoctor KDoctorπʔϧͰ ؀ڥߏஙͷ֬ೝՄೳ
  4. >ϓϩδΣΫτߏ੒ SampleComposeMultiplatformProject ... composeApp src androidMain kotlin MainActivity.kt commonMain ...

    kotlin App.kt iosMain kotlin MainViewController.kt build.gradle.kts gradle iosApp iosApp ContentView.swift iOSApp.swift.swift ...
  5. >ϓϩδΣΫτߏ੒ Android޲͚ͷ࣮૷ SampleComposeMultiplatformProject ... composeApp src androidMain kotlin MainActivity.kt commonMain

    ... kotlin App.kt iosMain kotlin MainViewController.kt build.gradle.kts gradle iosApp iosApp ContentView.swift iOSApp.swift.swift ...
  6. >ϓϩδΣΫτߏ੒ Android޲͚ͷ࣮૷ ڞ௨ͷ࣮૷ SampleComposeMultiplatformProject ... composeApp src androidMain kotlin MainActivity.kt

    commonMain ... kotlin App.kt iosMain kotlin MainViewController.kt build.gradle.kts gradle iosApp iosApp ContentView.swift iOSApp.swift.swift ...
  7. >ϓϩδΣΫτߏ੒ Android޲͚ͷ࣮૷ iOS޲͚ͷ࣮૷ ڞ௨ͷ࣮૷ SampleComposeMultiplatformProject ... composeApp src androidMain kotlin

    MainActivity.kt commonMain ... kotlin App.kt iosMain kotlin MainViewController.kt build.gradle.kts gradle iosApp iosApp ContentView.swift iOSApp.swift.swift ...
  8. >Compose MultiplatformͰදࣔ෼͚ SampleComposeMultiplatformProject ... composeApp src androidMain kotlin ... MainActivity.kt

    commonMain ... kotlin ... App.kt CustomAlertDialog.kt iosMain kotlin ... MainViewController.kt build.gradle.kts ...
  9. >Compose MultiplatformͰදࣔ෼͚ SampleComposeMultiplatformProject ... composeApp src androidMain kotlin ... MainActivity.kt

    CustomAlertDialog.android.kt commonMain ... kotlin ... App.kt CustomAlertDialog.kt iosMain kotlin ... MainViewController.kt build.gradle.kts ...
  10. >Compose MultiplatformͰදࣔ෼͚ SampleComposeMultiplatformProject ... composeApp src androidMain kotlin ... MainActivity.kt

    CustomAlertDialog.android.kt commonMain ... kotlin ... App.kt CustomAlertDialog.kt iosMain kotlin ... MainViewController.kt CustomAlertDialog.ios.kt build.gradle.kts ...
  11. >Compose MultiplatformͰදࣔ෼͚ SampleComposeMultiplatformProject ... composeApp src androidMain kotlin ... MainActivity.kt

    CustomAlertDialog.android.kt commonMain ... kotlin ... App.kt CustomAlertDialog.kt iosMain kotlin ... MainViewController.kt CustomAlertDialog.ios.kt build.gradle.kts ... Android iOS
  12. >OSݻ༗ͷॲཧ SampleComposeMultiplatformProject ... composeApp src androidMain kotlin ... MainActivity.kt Platform.android.kt

    CustomAlertDialog.android.kt commonMain ... kotlin ... App.kt Platform.kt CustomAlertDialog.kt iosMain kotlin ... MainViewController.kt Platform.ios.kt CustomAlertDialog.ios.kt build.gradle.kts ...
  13. >OSݻ༗ͷॲཧ SampleComposeMultiplatformProject ... composeApp src androidMain kotlin ... MainActivity.kt Platform.android.kt

    CustomAlertDialog.android.kt commonMain ... kotlin ... App.kt Platform.kt CustomAlertDialog.kt iosMain kotlin ... MainViewController.kt Platform.ios.kt CustomAlertDialog.ios.kt build.gradle.kts ...
  14. >OSݻ༗ͷॲཧ SampleComposeMultiplatformProject ... composeApp src androidMain kotlin ... MainActivity.kt Platform.android.kt

    CustomAlertDialog.android.kt commonMain ... kotlin ... App.kt Platform.kt CustomAlertDialog.kt iosMain kotlin ... MainViewController.kt Platform.ios.kt CustomAlertDialog.ios.kt build.gradle.kts ...
  15. >·ͱΊ Compose MultiplatformͷPreview • androidMainͰPreview͢Δ or Fleet IDEͰ֬ೝ ը໘ભҠ /

    ϥΠϑαΠΫϧͳͲ • ࣮ݧ൛͕ͩެࣜͷରԠ͕ਐΜͰ͍Δ • ݱঢ়͸੍ݶࣄ߲ͳͲ͕͋ΔͨΊଞͷϥΠϒϥϦͷݕ౼΋ඞཁ ϓϥοτϑΥʔϜຖͷදࣔ෼͚΋΋ͪΖΜՄೳ • commonMainͰexpectɺͦΕͧΕͷϓϥοτϑΥʔϜ޲͚ʹactual
  16. ৘ใͷΩϟονΞοϓ • JetBrains Kotlin Multiplatform Development • Kotlin Multiplatform samples

    • Kmp-awesome • Kotlin Multiplatform Overview ·ͣ͸ҎԼ͕͓͢͢Ί
  17. ࢀߟ • Compose Multiplatform 1.5.10 – The Perfect Time To

    Get Started • Create a Compose Multiplatform app — tutorial • Compose Multiplatform for iOS Is in Alpha • Use platform-speci f ic APIs • Create a multiplatform app using Ktor and SQLDelight • Navigation and routing • Common ViewModel • Compose Multiplatform on iOS - KotlinConf’23 • JetBrains/compose-multiplatform/compose • JetBrains/compose-multiplatform-core • Compose to Kotlin Compatibility Map • Kotlin Slack Community