kmm

Kotlin Multiplatform Mobile – Intro & Workshops


What is Kotlin Multiplatform Mobile?

  • Kotlin Multiplatform is an SDK for cross-platform mobile development, which enables teams to use the same business logic in both Android and iOS client applications.
  • Kotlin Multiplatform is written using Kotlin, an open source language from the Jetbrains team.
  • The shared code written in Kotlin is compiled to different formats depending on the target platform. For Android, it is compiled to Java bytecode, whereas on iOS it is compiled to a native binary.
  • The user interface development remains in the hands of the respective platform.

Benefits

  • DRY (Don’t Repeat Yourself) – Reduced code and test duplication, while retaining the flexibility and benefits of native development.
  • Code Consistency – Variations in business logic can be reduced or eliminated completely.
  • Code Reuse – Existing Kotlin code has the potential to be migrated into the new project.

Familiarity & Community Support

  • Existing Languages – Developers can continue to write code natively using modern languages, and always have access to the latest APIs.
  • Tooling – Long term Kotlin and KMM ecosystem support and updates from Jetbrains; an industry leader in development tools and technologies.

Requirements

Getting Started

Make sure you clone the repo in advance of the workshop:

git clone https://github.com/ninehundreds/kmm-works.git

Workshop 1 – Introduction and Basic Networking


Enter the newly cloned project directory, and checkout the network starter branch:

cd kmm-works
git checkout workshop/network-starter

This workshop will introduce Kotlin Multiplatform Mobile, and review it’s intended purpose and capabilities. We will also discuss its benefits, as well as drawbacks. Hands-on segments will consist of:

  1. Project Creation / Dependency Management
  2. Project Structure
  3. Networking with Ktor
    • Model and interface definitions (CRUD)
    • Service and HTTP client functions / implementation
    • Service interaction from the iOS client
    • Service interaction from the Android client
  4. Hackathon Challenge

Workshop 2 – Databases and Other Disappointments


This workshop will carry on from the previous workshop, and introduce options for persisting data locally using KMM. Hands-on segments will consist of:

  1. Implementing local persistence with SQLDelight
  2. Implementing local persistence with Realm
  3. Interacting with local persistence in the clients

Branch Reference

  • workshop/network-starter branch: consists of starter template, with ktor and serialization dependencies.
  • workshop/network-final branch: consists of basic networking example with CRUD functions.

GitHub

View Github