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.
- 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.
- macOS machine running 10.14 (Mojave) or above.
- Xcode 11.3 or higher
- Android Studio 4.2 or 2020.3.1 Canary 8 or higher
- Kotlin Multiplatform Mobile plugin
- JDK 11+
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:
- Project Creation / Dependency Management
- Project Structure
- 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
- 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:
- Implementing local persistence with SQLDelight
- Implementing local persistence with Realm
- Interacting with local persistence in the clients
- 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.