Kotlin Multiplatform by Tutorials
Build native apps faster and more reliably by sharing code across Android, iOS and desktop. By Carlos Mota, Saeed Taheri & Kevin D Moore.
Who is this for?
This book is for mobile developers and managers who want to explore how they can use Kotlin Multiplatform in different use cases to share code across Android, iOS and desktop apps. If you want to reduce development and testing time by writing certain parts of your apps only once, this book will help.
Covered concepts
- Jetpack Compose Android
- Compose Multiplatform
- SwiftUI
- Testing
- Dependency Injection with Koin
- Persistence using SQLDelight
- Serialization
- Ktor
- Concurrency using coroutines
The best book to teach you how to share code across platforms using Kotlin Multiplatform. You’ll gain the foundation of creating user interfaces using native UI toolkits and then writing common code for serialization, networking and persistence. You’ll also learn how dependency injection, testing and different architectures fit in with...
moreBefore You Begin
This section tells you a few things you need to know before you get started, such as what you’ll need for hardware and software, where to find the project files for this book, and more.
Section I: Beginning Kotlin Multiplatform
One of the core benefits of Kotlin Multiplatform is that you can share code across native apps. You can continue to develop the UI layer using native UI toolkits like Jetpack Compose for Android and SwiftUI for iOS.
In this section, you’ll learn how to add a new Gradle module to write your business logic only once. You’ll also learn how to create the native UI for Android, iOS and desktop apps, all while sharing the common module.
Section II: Kotlin Multiplatform: Intermediate
To effectively share code across apps, there are multiple things to keep in mind: access to platform-specific APIs, support for existing software engineering practices and persistence.
In this section, you’ll learn how to use Kotlin features to access platform-specific APIs in your shared module and how Kotlin Multiplatform fits in with your current architecture. You’ll also learn about dependency injection and how you can use it to test features present in your shared modules. Finally, you’ll learn how to use a common codebase to handle persistence on different platforms.
Section III: Kotlin Multiplatform: Advanced
Networking is crucial to most modern apps, and it usually involves implementing similar logic using different frameworks and languages. Under the hood, it also involves concepts like serialization and concurrency. Fortunately, Kotlin Multiplatform has dedicated libraries for each of these.
In this section, you’ll learn how to use serialization to decode JSON data to Kotlin objects. You’ll then learn how to use a common networking library that leverages this common serialization to fetch data from the internet. To make the networking performant, you’ll also learn about concurrency in Kotlin using coroutines and the considerations for different platforms. Finally, you’ll learn how to extract an existing feature to a Kotlin Multiplatform library and also different ways of publishing this library.