Kotlin logo

Kotlin

A concise multiplatform language developed by JetBrains

Multiplatform

Sample the World of Kotlin Multiplatform Mobile

One of the main benefits of Kotlin Multiplatform Mobile is its flexibility. You can use KMM in your existing or new projects, share different parts of your apps, and integrate with different UI frameworks. To find the best way to apply this flexibility in your project and maximize the benefits of using KMM, it can really help to look at how other projects have used it. Today we’ll look at the KMM sample projects that are available!

Explore a variety of KMM sample projects

There are a lot of decisions to make when first introducing KMM to your team, everything from which architecture to use to who will be writing the shared code. Sample projects are a great source of inspiration to help you make such decisions. You can look into their codebase and see how things are implemented and use them as a playground to try new things as well. Since going Alpha, the number of samples has grown and continues to grow. Here are a few exciting samples that cover different code-sharing use cases:

  • The D-KMP sample demonstrates how to fully share the ViewModel (including the navigation layer) with KMM. It implements the MVI and CQRS patterns, and uses the latest declarative UI toolkits, Compose for Android and SwiftUI for iOS.
  • The multiplatform-redux-sample shows how to build a cross-platform application with KMM and ReduxKotlin.
  • The famous people-in-space project is a great demonstration of the power of the Kotlin Multiplatform technology. In addition to sharing all the business logic and using modern mobile UI toolkits, it uses Compose Desktop, so you can run this sample application on your PC!
  • KMM production sample is an official sample from the JetBrains team. It’s a simple RSS reader that you can download from the App Store and Google Play. It’s designed to demonstrate how KMM can be used in real production projects, providing a comprehensive readme with an explanation of the architecture so you can apply the approaches in your own projects. This sample has been already migrated to the new Kotlin/Native memory manager development preview!
  • Kamp-Kit is a collection of code and tools designed to help you get started quickly. In addition to a native mobile KMM app with a small functional feature set, it also contains educational resources and guides on integrating shared code into an existing application.

All this is just the beginning! Check out the table on the KMM documentation portal to find a sample similar to what you want for your KMM project and take a deep dive into KMM right away! For example, you can find a sample that uses SQLDelight for data storage, modern declarative frameworks for the user interface, and that has the logic shared not only between mobile apps but also between a web client. 

Find the perfect KMM sample!

Become the part of the growing ecosystem

Do you have an example of how you implemented KMM that you think others could benefit from? Create your own sample!  For example, you can demonstrate how to maximize the amount of shared code or how to organize your project when you want to store native and shared parts of your application in separate repositories. Sample projects like these really help the KMM ecosystem and help us all evolve. Feel free to reach out to us and tell us about your project! We are grateful to all inspiring sample project authors and would be happy to add yours to the official list. 

Read more

image description