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

Kotlin Multiplatform!

Ac5b39a4b12e8ca2d6e25b9e7cc142ae?s=47 Divya Jain
August 27, 2021

Kotlin Multiplatform!

Kotlin Multiplatform Projects are quickly becoming a popular new way to reuse code between multiple platforms by focusing on sharing the logical code and still writing platform specific needs natively. A quick presentation around its power, how to architect a simple app using Kotlin Multiplatform and some benefits.
Presented this talk at Droidcon Nigeria.


Divya Jain

August 27, 2021

More Decks by Divya Jain

Other Decks in Programming


  1. Architecting a Kotlin Multiplatform Divya Jain

  2. Hello! I am Divya Jain Mobile App Developer You can

    find me at @divyajain2405 2
  3. “Single codebase, Shared business logic for Android & IOS, through

    pure Kotlin 3 Common JVM JS Native Note: Cross platform only for shared business logic, UI is still native in Kotlin/Swift etc
  4. KMM Project Structure ⬡ Shared Module ⬡ Android Application ⬡

    IOS Application 4
  5. Expect “Expected declaration” in the common module for functions, classes,

    enums , properties etc. Expect/Actual mechanism Actual “Actual declaration” in the platform module corresponding to the expected one. 5 expect common Actual IOS native declaration Actual Android native declaration
  6. commonMain ios android

  7. 7 KMM Plugin

  8. 8 New KMP Project Android Studio: v4.2

  9. 9

  10. KMM-Books An app using KMM which displays a list of

    Books with name, brief description & author. 10
  11. 11

  12. 12

  13. 13

  14. 14

  15. 15 https://github.com/djain2405/kotlin-multiplatform-booklist

  16. Ktor for Networking Open source framework to build connected applications

    (Web, Http services, mobile, browser) Asynchronous multi platform client 16
  17. 17 https://github.com/ktorio/ktor-samples

  18. Clean Architecture with KMM 18 Domain Models DataSource Cache SQL

    Delight Network Ktor Use Cases & user interaction handlers Shared module - kotlin Platform Specific UI Presentation Layer
  19. Benefits of KMM Significant Savings Faster Development time, cause using

    Kotlin for Mobile & web, we are writing the business logic code only once. Fewer Bugs & testable Allows developers to create clean code, shared business logic is unit testable & bugs are less and caught much early on. Almost a Native experience The UI is still built natively, it’s just shared logic. Utilize power of each platform without the overhead. Flexibility & platform consistent user experience. 19
  20. Kotlin Multiplatform holds all the key promises and possibilities similar

    to Kotlin & emerges as a well-equipped solution for cross-platform app development projects. 20
  21. Thank You! @divyajain2405 https://github.com/djain2405 21