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)
Section 1 - Getting Started with Multiplatform Mobile Development Using Kotlin
Section 2 - Code Sharing between Android and iOS
Section 3 - Supercharging Yourself for the Next Steps

Initial project setup

By now you should have all the tools ready to start developing Dogify. In case you missed something, feel free to explore Chapter 4, Introducing the KMM Learning Project, where I described the tools you'll need.

So, let's start creating the project. Open the Android Studio New Project wizard (Android Studio | New Project). From the Phone and Tablet tab, select KMM Application:

Figure 5.1 – KMM Application template

If you can't see such a template, you're probably missing the KMM Plugin for Android Studio. You can find more about how to install it in Chapter 4, Introducing the KMM Learning Project.

Now in the next section, you'll see a configuration page. We'll be using Minimum SDK: API 23 and Kotlin scripts for Gradle build files, so make sure that Use Kotlin script (.kts) for Gradle build files is checked. Of course feel free to tweak these attributes, though we're going to use these settings...