Slide 1

Slide 1 text

Write Once, Run Everywhere: Introduction to Kotlin Multiplatform @lamouresparus KotlinConf’24 Minna

Slide 2

Slide 2 text

Meet Me Hi there, I am Love Otudor.

Slide 3

Slide 3 text

Agenda

Slide 4

Slide 4 text

● The Multiplatform Challenge ● What is Kotlin Multiplatform? ● Advantages of Kotlin Multiplatform ● Limitations of Kotlin Multiplatform ● Get Started ● Resources Agenda

Slide 5

Slide 5 text

The Multiplatform Challenge

Slide 6

Slide 6 text

Web Android iOS Desktop Multiple OS

Slide 7

Slide 7 text

Common Logic Common Code Image generated by Gemini

Slide 8

Slide 8 text

What is Kotlin Multiplatform?

Slide 9

Slide 9 text

Kotlin Multiplatform is a framework by JetBrains to simplify cross-platform development.

Slide 10

Slide 10 text

Write shared code once and run it on multiple platforms.

Slide 11

Slide 11 text

Subtitle Text What Platforms?

Slide 12

Slide 12 text

Subtitle Text ● Server ● Mobile ● Desktop ● Web What Platforms?

Slide 13

Slide 13 text

Image from kotlinlang.org

Slide 14

Slide 14 text

Subtitle Text ● iOS, ● Android, ● macOS, ● Windows, ● Linux, and others. Multiplatform applications will work on:

Slide 15

Slide 15 text

Write shared code once and run it on multiple platforms.

Slide 16

Slide 16 text

Before Kotlin Multiplatform Data (repository/HTTP client) iOS Domain (use cases/entities) Presentation (viewmodels/controllers) UI (views) Data (repository/HTTP client) Android Domain (use cases/entities) Presentation (viewmodels/controllers) UI (views) Data (repository/HTTP client) Desktop Domain (use cases/entities) Presentation (viewmodels/controllers) UI (views)

Slide 17

Slide 17 text

With Kotlin Multiplatform

Slide 18

Slide 18 text

With Kotlin Multiplatform: Share Business Logic iOS Presentation (viewmodels/controllers) UI (views) Android Presentation (viewmodels/controllers) UI (views) Desktop Presentation (viewmodels/controllers) UI (views) Data (repository/HTTP client) Domain (use cases/entities) Shared Module

Slide 19

Slide 19 text

With Compose Multiplatform

Slide 20

Slide 20 text

Share Business Logic and UI iOS Platform Specific code Android Platform Specific code Desktop Platform Specific code Data (repository/HTTP client) Domain (use cases/entities) Shared Module Presentation (viewmodels/controllers) UI (views)

Slide 21

Slide 21 text

Compose Multiplatform is a UI declarative framework that makes it possible to build UI once and share it across multiple platforms with Kotlin.

Slide 22

Slide 22 text

Compose Multiplatform lets you share more Kotlin Multiplatform code, not just the app's logic but also the UI.

Slide 23

Slide 23 text

Advantages of Kotlin Multiplatform

Slide 24

Slide 24 text

● Kotlin compiles directly to machine code for each target platform (Android, iOS, etc.). ● Direct access to native APIs on each platform. Advantages

Slide 25

Slide 25 text

● Reduce time spent writing and maintaining the same code for different platforms. ● Retain the flexibility and benefits of native programming. Advantages

Slide 26

Slide 26 text

Limitations of Kotlin Multiplatform

Slide 27

Slide 27 text

● Requires pure Kotlin libraries in the shared module. ● Mac Development for iOS. Limitations

Slide 28

Slide 28 text

Get Started

Slide 29

Slide 29 text

1. Setup your environment

Slide 30

Slide 30 text

1. Setup your environment JDK 1. Android Studio version 2.2 and higher comes with the latest OpenJDK. 2. To check, run java -version on your terminal

Slide 31

Slide 31 text

1. Check your environment 1. Install KDoctor. Mac Users only 2. After the installation is completed, call KDoctor in the console:

Slide 32

Slide 32 text

2. Create the project with wizard kmp.jetbrains.com Image from Jetbrains

Slide 33

Slide 33 text

2. Create the project with wizard 5. Click the Download button and unpack the resulting archive.

Slide 34

Slide 34 text

3. Project Structure Image from Jetbrains

Slide 35

Slide 35 text

4. Run your app Image from Jetbrains

Slide 36

Slide 36 text

Resources

Slide 37

Slide 37 text

● Create a Kotlin Multiplatform app — tutorial ● Create your first cross-platform app ● Introduction to Kotlin Multiplatform ● Kotlin Multiplatform Tutorial for Beginners - Your First KMP App Resources

Slide 38

Slide 38 text

Thank you