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

KMM Kickstart For Android Developers

KMM Kickstart For Android Developers

Overview of the KMM ecosystem for Android developers. We're hiring and training folks, so pushed the basics into a bunch of slides. https://touchlab.co/careers-3/

Kevin Galligan

May 05, 2021
Tweet

More Decks by Kevin Galligan

Other Decks in Technology

Transcript

  1. KMM Kickstart For Android Developers Kevin Galligan

  2. Touchlab

  3. None
  4. KMM Kickstart For Android Developers:

  5. KMM Kickstart For Android Developers: we’re hiring

  6. Xcode Frameworks K/N Threading Linker?

  7. You fell victim to one of the classic blunders!

  8. We’ll Cover • Overview of KMP/KM M • Status/future of

    the tec h • KaMP Ki t • Architecture Thought s • Tool s • Next Steps
  9. Technology Definitions

  10. Kotlin Multiplatform (KMP)

  11. Common JVM JS Native

  12. It’s the interop generally very good

  13. Common JVM JS Native

  14. Common JVM JS Native iOS Mac Linux Windows Android/NDK Wasm

    Others… Java-6 Java-8 Android Browser Node Typescript(?)
  15. Kotlin Multiplatform Mobile (KMM)

  16. KMM •is mostly a branding designation (it’s still KMP )

    •has a dedicated website and docs to help get starte d •has an Android Studio plugin built just for mobile (ish)
  17. Why KMP/KMM?

  18. kot·lin mul·ti·plat·form /ˌkätˈlin məltiˈplatfôrm,ˌkätˈlin məltīˈplatfôrm/ noun noun: kotlin multiplatform 1.optional,

    natively-integrated, open-source, code sharing platform, based on the popular, modern language kotlin. facilitates non-ui logic availability on many platforms.
  19. kot·lin mul·ti·plat·form /ˌkätˈlin məltiˈplatfôrm,ˌkätˈlin məltīˈplatfôrm/ noun noun: kotlin multiplatform 1.optional,

    natively-integrated, open-source, code sharing platform, based on the popular, modern language kotlin. facilitates non-ui logic availability on many platforms. Oh, and JetBrains!
  20. Shared Native Code not “cross platform”

  21. Android is Kotlin half of it isn’t “cross platform”

  22. Not (necessarily) UI Compose and Swift UI compatible!

  23. None
  24. None
  25. Low Risk bigger orgs worry about such

  26. Memory Lane

  27. 2020 is KMP’s year it’s all coming together

  28. None
  29. https://kotlinlang.org/lp/mobile/case-studies/

  30. None
  31. KMM Developer https://touchlab.co/careers-3/

  32. KMM Developer https://touchlab.co/careers-3/ (Remote, now and post-pandemic)

  33. KMM Status it’s complicated

  34. https://kotlinlang.org/docs/mobile/kmm-evolution.html Kotlin/JVM Stable Kotlin/Native Runtime Beta Multiplatform Gradle plugin Beta

    Kotlin/Native interop with C and Objective C Beta CocoaPods integration Beta Multiplatform IDE support Alpha KMM plugin for Android Studio Experimental
  35. None
  36. https://www.youtube.com/watch?v=L8Xq15NTuCc

  37. KaMP Kit

  38. None
  39. May 2021 where are we?

  40. https://kotlinlang.org/lp/mobile/

  41. None
  42. First 5 Minutes hit the ground running

  43. None
  44. None
  45. Alternatives we like…

  46. https://github.com/joreilly/PeopleInSpace

  47. https://github.com/joreilly/PeopleInSpace

  48. https://github.com/Kotlin/kmm-production-sample

  49. But Compose?! one new thing at a time

  50. OK, Actually Starting they say never live code…

  51. OK, Actually Starting they say never live code…

  52. General Patterns what we’re seeing

  53. Specific Modules

  54. Analytics Android Framework Android Stuff iOS Stuff

  55. Shared Architecture

  56. Analytics Android Framework Android Stuff iOS Stuff

  57. App Stuff Android Framework Android Stuff iOS Stuff

  58. KaMP Kit is Shared Architecture

  59. None
  60. I’m mostly not UI layer

  61. LinearLayout FTW Compost? fill_parent?

  62. App Stuff Android Framework Android Stuff iOS Stuff

  63. App Stuff Framework

  64. App Stuff Framework lambda lambda

  65. App Stuff Framework VM/Lifecycle Coroutines

  66. Android is pretty simple iOS is a debate

  67. App Stuff Framework lambda VM/Lifecycle Coroutines

  68. Compiler Created Interfaces call suspend functions from iOS

  69. Community Libraries

  70. Working on a thing coming soon…

  71. App Stuff Framework VM/Lifecycle Coroutines VC/Lifecycle- Aware Coroutine Scope/ Interface

    Manager
  72. App Stuff Framework lambda VM/Lifecycle Coroutines

  73. Libraries

  74. Libraries • SQLDelight (DB ) • Ktor (Networking ) •

    Kotlinx.Serialization (Json ) • Kotlinx.Coroutines (Async/ Concurrency) • Kermit (logging ) • Multiplatform Settings (Key/Value ) • Stately (K/N Concurrency ) • Koin (DI/not-DI?)
  75. None
  76. CREATE TABLE Breed ( id INTEGER NOT NULL PRIMARY KEY

    AUTOINCREMENT, name TEXT NOT NULL UNIQUE, favorite INTEGER NOT NULL DEFAULT 0 ); selectAll: SELECT * FROM Breed; selectById: SELECT * FROM Breed WHERE id = ?; selectByName: SELECT * FROM Breed WHERE name = ?; insertBreed: INSERT OR IGNORE INTO Breed(id, name) VALUES (?,?); deleteAll: DELETE FROM Breed; updateFavorite: UPDATE Breed SET favorite = ? WHERE id = ?;
  77. public data class Breed( public val id: Long, public val

    name: String, public val favorite: Long ) { public override fun toString(): String = """ |Breed [ | id: $id | name: $name | favorite: $favorite |] """.trimMargin() }
  78. public interface TableQueries : Transacter { public fun <T :

    Any> selectAll(mapper: ( id: Long, name: String, favorite: Long ) -> T): Query<T> public fun selectAll(): Query<Breed> public fun <T : Any> selectById(id: Long, mapper: ( id: Long, name: String, favorite: Long ) -> T): Query<T> public fun selectById(id: Long): Query<Breed> public fun <T : Any> selectByName(name: String, mapper: ( id: Long, name: String, favorite: Long ) -> T): Query<T> //Yada yada }
  79. Tools

  80. Android Studio obviously

  81. None
  82. Xcode you’re *definitely* going to use Xcode

  83. https://github.com/touchlab/xcode-kotlin

  84. Some More Info

  85. Kotlin/Native Concurrency

  86. Common JVM JS Native

  87. None
  88. Two Rules it’s actually pretty simple

  89. Mutable == 1 thread

  90. Immutable == many threads

  91. Immutable means Frozen call freeze()

  92. None
  93. Xcode Frameworks like AAR’s (kind of)

  94. Xcode Frameworks like AAR’s (kind of)

  95. Xcode Frameworks like AAR’s (kind of)

  96. Interface is Objective-C swift is pretty good at talking to

    Objc
  97. Analytics Android Framework Android Stuff iOS Stuff

  98. Analytics Android Framework Android Stuff iOS Stuff Tax Calc Framework

  99. Analytics Android Framework Android Stuff iOS Stuff Tax Calc Framework

  100. https://www.youtube.com/watch?v=hrRqX7NYg3Q

  101. Touchlab

  102. What’s Next?

  103. KaMP Kit Docs • More on Concurrenc y • “Selling”

    to your tea m • Some info on integrating with existing project s • Other assorted docs
  104. Kotlin Slack this is critical

  105. https://kotlinlang.org/lp/mobile/

  106. Final Words quick Touchlab pitch

  107. None
  108. KMM Developer https://touchlab.co/careers-3/

  109. KMM Developer https://touchlab.co/careers-3/ Will train Android devs!

  110. KMM Developer https://touchlab.co/careers-3/ (Also looking for KMP/KMM experts)

  111. None
  112. None
  113. Thanks! @kpgalligan touchlab.co