Kotlin Multiplatform Development
 

Create a multiplatform app using Ktor and SQLDelight

Edit pageLast modified: 14 October 2024

This tutorial demonstrates how to use Android Studio to create an advanced mobile application for iOS and Android using Kotlin Multiplatform. This application is going to:

  • Retrieve data over the internet from the public SpaceX API using Ktor

  • Save the data in a local database using SQLDelight.

  • Display a list of SpaceX rocket launches together with the launch date, results, and a detailed description of the launch.

The application will include a module with shared code for both the iOS and Android platforms. The business logic and data access layers will be implemented only once in the shared module, while the UI of both applications will be native.

Emulator and Simulator

You will use the following multiplatform libraries in the project:

  • Ktor as an HTTP client for retrieving data over the internet.

  • kotlinx.serialization to deserialize JSON responses into objects of entity classes.

  • kotlinx.coroutines to write asynchronous code.

  • SQLDelight to generate Kotlin code from SQL queries and create a type-safe database API.

  • Koin to provide platform-specific database drivers via dependency injection.