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

Musings on Kotlin Multiplatform Mobile

Ce5b219b385d3e316a553d8a41900ed9?s=47 Annyce D.
January 28, 2021

Musings on Kotlin Multiplatform Mobile

In this talk, I share my initial thoughts on Kotlin Multiplatform Mobile (KMM). I walk through how I started on this journey. I also compare my experience with KMM to that of working with Flutter. Flutter is another cross-platform solution that I've worked with in the past.

Ce5b219b385d3e316a553d8a41900ed9?s=128

Annyce D.

January 28, 2021
Tweet

More Decks by Annyce D.

Other Decks in Technology

Transcript

  1. Annyce Davis - @brwngrldev Musings on Kotlin Multiplatform Mobile January

    2021
  2. @brwngrldev

  3. @brwngrldev

  4. @brwngrldev

  5. My journey How I got started with KMM 1. Attended

    an AMA 2. Started following devs on Twitter 3. Pulled down a sample app 4. Wrote a sample app 5. Read documentation 6. Watched videos on YouTube @brwngrldev
  6. After the AMA I finally started to get it! K

    otlin K otlin/N ative K M P K M M @brwngrldev
  7. Twitter friends What are folks up to with KMM @brwngrldev

  8. Todo App Created with KMM plugin @brwngrldev

  9. • Ktor • Koin • Kermit • SwiftUI • Jetpack

    Components Developed with: @brwngrldev
  10. Architecture Created with KMM plugin Data model API Repository Dependency

    Injection Shared code Todo App iOS Project Android Project @brwngrldev
  11. Data model Kotlinx Serialization @Serializable data class Todo( @SerialName("id") val

    id: Int, @SerialName("title") val title: String, @SerialName("completed") val completed: Boolean ) @brwngrldev
  12. API Ktor private val httpClient = HttpClient { install(JsonFeature) {

    val json = Json { ignoreUnknownKeys = true } serializer = KotlinxSerializer(json) } } override suspend fun getAllTodos(): List<Todo> { return httpClient.get(ENDPOINT) } @brwngrldev
  13. Repository Koin and Kermit private val api: TodosApi by inject()

    private val logger: Kermit by inject() private val todos: MutableList<Todo> = mutableListOf() @brwngrldev
  14. Repository Koin and Kermit private val api: TodosApi by inject()

    private val logger: Kermit by inject() private val todos: MutableList<Todo> = mutableListOf() @Throws(Exception::class) suspend fun getAllTodos(forceReload: Boolean): List<Todo> { logger.i{ "loading todos" } return if (todos.isNotEmpty() && !forceReload) { todos } else { api.getAllTodos().also { todos.clear() todos.addAll(it) } } } @brwngrldev
  15. Wasn’t all roses • Struggled with using Koin in the

    iOS app • Couldn’t figure out how to use the Kermit logger in the iOS app • Android Studio would misbehave often • I didn’t know any SwiftUI Challenges
  16. How does KMM compare? @brwngrldev

  17. Comparison Standard/KMM/Flutter Standard KMM Flutter Language Learning Curve Maturity Platform

    UI Community @brwngrldev
  18. Comparison Standard/KMM/Flutter Standard KMM Flutter Language ⭐⭐ ⭐⭐ ⭐ Learning

    Curve Maturity Platform UI Community @brwngrldev
  19. Comparison Standard/KMM/Flutter Standard KMM Flutter Language ⭐⭐ ⭐⭐ ⭐ Learning

    Curve ⭐⭐ ⭐⭐ ⭐ Maturity Platform UI Community @brwngrldev
  20. Comparison Standard/KMM/Flutter Standard KMM Flutter Language ⭐⭐ ⭐⭐ ⭐ Learning

    Curve ⭐⭐ ⭐⭐ ⭐ Maturity ⭐⭐ ⭐ Platform UI Community @brwngrldev
  21. Comparison Standard/KMM/Flutter Standard KMM Flutter Language ⭐⭐ ⭐⭐ ⭐ Learning

    Curve ⭐⭐ ⭐⭐ ⭐ Maturity ⭐⭐ ⭐ Platform UI ⭐⭐ ⭐⭐ ⭐ Community @brwngrldev
  22. Comparison Standard/KMM/Flutter Standard KMM Flutter Language ⭐⭐ ⭐⭐ ⭐ Learning

    Curve ⭐⭐ ⭐⭐ ⭐ Maturity ⭐⭐ ⭐ Platform UI ⭐⭐ ⭐⭐ ⭐ Community ⭐⭐ @brwngrldev
  23. Community @brwngrldev

  24. @brwngrldev

  25. Mascot KroN Kira the Nightingale Meant for illustration purposes @brwngrldev

  26. Libraries Official listing from JetBrains https://github.com/AAkira/Kotlin-Multiplatform-Libraries @brwngrldev

  27. Video tutorials (see Boring Flutter show) @brwngrldev

  28. Recommendations How to get more folks into KMM • Mascot

    (Kron or Kira) • Listing of available libraries • Social media tips (Multiplatform Mondays) • YouTube content from a variety of creators • More codelabs • Partner with existing groups of iOS and Kotlin influencers • Weekly office hours @brwngrldev
  29. Thanks! @brwngrldev