Book Image

Simplifying Application Development with Kotlin Multiplatform Mobile

By : Róbert Nagy
Book Image

Simplifying Application Development with Kotlin Multiplatform Mobile

By: Róbert Nagy

Overview of this book

Sharing code between platforms can help developers gain a competitive edge, and Kotlin Multiplatform Mobile (KMM) offers a sensible way to do it. KMM helps mobile teams share code between Android and iOS in a flexible way, leaving room for native development. The book begins by helping you to gain a clear understanding of the Kotlin Multiplatform approach, how it works, and how it is different from cross-platform technologies, such as React Native and Flutter, and code sharing options, such as C++. You'll then see how your team can use this software development kit (SDK) to build native applications more effectively by learning timeless concepts and working through practical examples. As you advance, you'll get to grips with the core concepts, understand why UI sharing fails, and get hands-on with developing a small KMM application. Finally, you'll discover expert tips and best practices, along with production- and adoption-related questions, that will help you take the next step in your project and career. By the end of this Kotlin book, you'll have gained a solid understanding of the capabilities of KMM and be able to share code between Android and iOS flexibly.
Table of Contents (15 chapters)
1
Section 1 - Getting Started with Multiplatform Mobile Development Using Kotlin
5
Section 2 - Code Sharing between Android and iOS
10
Section 3 - Supercharging Yourself for the Next Steps

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in the text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "For every Gradle module/project, you'll have a build.gradle (or .kts) file describing the build steps for that specific module."

A block of code is set as follows:

plugins {
    kotlin("multiplatform")
    id("com.android.library")
    kotlin("plugin.serialization") version
      Versions.KOTLIN_VERSION
    id("org.jetbrains.kotlin.native.cocoapods")
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

// Swift unwrapping
if let string = optional {
    print(string.count)
} else {
    print("I'm nil")
}

Any command-line input or output is written as follows:

$ mkdir css
$ cd css

Bold: Indicates a new term, an important word, or words that you see on screen. For instance, words in menus or dialog boxes appear in bold. Here is an example: "Open the Android Studio New Project wizard (Android Studio | New Project). From the Phone and Tablet tab, select KMM Application."

Tips or Important Notes

Appear like this.