Unlock the Power of KMM Libraries

Find AI Tools in second

Find AI Tools
No difficulty
No complicated process
Find ai tools

Unlock the Power of KMM Libraries

Table of Contents:

  1. Introduction
  2. Choosing Kotlin Multi-Platform (KMP)
  3. Benefits of KMP for Developers
    • Reduced code duplication
    • Enhanced product resilience
    • Fewer platform-specific bugs
  4. The Beginnings of KMP at Meetup
    • Mob Sessions and prototypes
    • Onboarding engineers and addressing concerns
    • Treating iOS developers well
  5. KMP Libraries for Improved Development
    • Apollo GraphQL
    • Ktor
    • SQL Delight
    • Moko Resources
    • Kotlinx Serialization
    • Multi-platform Settings
    • Multi-platform Paging
    • Dependency injection with Koin
    • Kermit for logging and crashlytics
    • KotlinX Coroutines Extensions
    • MokoK Swift
  6. What's Next for Kotlin at Meetup
    • Transitioning to a shared library
    • Moving towards a monorepo
  7. Testing and Test Libraries in KMP
    • JUnit and MockK
    • CoTest assertions
  8. The App Size and Performance of KMP
  9. Challenges and Watch Outs with KMP Integration
    • Threading carefully with compiler plugins
    • Considerations for testing
  10. Defining the Boundary Between KMP and Client Apps
    • Exposing UI state and lower-level concepts
  11. Implementing Custom Solutions in KMP
  12. Conclusion

Article:

Introduction

Hello, folks! My name is Colin Lee and I work for Meetup as an Android developer. Meetup is a platform with over 60 million members that facilitates groups Based on shared interests like hiking, photography, and more. In this article, I will discuss how Meetup started using Kotlin Multi-Platform (KMP) and the benefits it has brought to our development process.

Choosing Kotlin Multi-Platform (KMP)

At Meetup, we had plans to develop a Second app specifically for our organizers who put in a significant amount of effort into running their groups. We wanted to Create a custom app that would better serve their needs. However, we faced challenges as we had been building separate Android and iOS apps, which resulted in platform-specific bugs and inconsistencies. This is where KMP came in as a solution.

Benefits of KMP for Developers

By adopting KMP, we have experienced several advantages that have improved our development process:

  • Reduced code duplication: With KMP, we write shared code that can be used across both Android and iOS platforms, eliminating the need to build separate codebases.
  • Enhanced product resilience: Fewer platform-specific bugs means a more stable and reliable product for our users.
  • Fewer platform-specific bugs: By sharing code, we mitigate the chances of encountering platform-specific bugs that can cause crashes or issues for users.

The Beginnings of KMP at Meetup

Our Journey with KMP started with mob sessions and prototypes. We brought together a team of Android and iOS engineers to work on a prototype and quickly realized the potential of KMP. We onboarded more engineers and addressed any concerns they had about using Kotlin, ensuring that everyone felt confident and supported throughout the process. Treating our iOS developers well was crucial to driving the adoption of KMP within our organization.

KMP Libraries for Improved Development

To further enhance our development process, we leveraged various KMP libraries that have proven beneficial for our team:

  1. Apollo GraphQL: This library enables us to make efficient and powerful GraphQL requests, reducing the number of network requests needed for our app.
  2. Ktor: Ktor is our go-to library for making REST API calls in a shared way, providing a seamless experience across platforms.
  3. SQL Delight: SQL Delight allows us to write Type-safe SQL queries and generates code for both Android and iOS, resulting in a more efficient and reliable database integration.
  4. Moko Resources: Moko Resources simplifies the handling of localized strings and resources, making it easier for our iOS developers to work with Kotlin code.
  5. Kotlinx Serialization: With kotlinx Serialization, we can easily serialize and deserialize Kotlin objects, making network and database interactions smoother.
  6. Multi-platform Settings: This library provides a convenient way to store and retrieve key-value pairs across platforms, including secure storage for iOS.
  7. Multi-platform Paging: We use multi-platform paging to handle pagination in a shared way, ensuring a consistent and seamless user experience.
  8. Dependency injection with Koin: Koin is a lightweight dependency injection framework that simplifies managing dependencies in our shared code.
  9. Kermit: Kermit is a logging and crash reporting library that helps us streamline logging across both Android and iOS platforms.
  10. KotlinX Coroutines Extensions: We rely on KotlinX coroutines extensions for handling asynchronous programming and managing concurrency in our shared codebase.
  11. MokoK Swift: MokoK Swift allows us to write Swift enums that mirror Kotlin sealed classes, improving code consistency and reducing bugs.

What's Next for Kotlin at Meetup

We Are currently working towards consolidating our apps into a single shared library, reducing duplication and improving code reuse across different Meetup apps. Transitioning to a monorepo has also been beneficial as it allows us to work with the entire codebase in a streamlined manner.

Testing and Test Libraries in KMP

For testing, we primarily use JUnit and MockK, which provide robust and reliable testing capabilities for shared code in KMP. Additionally, CoTest assertions offer a wide range of assertions for testing data classes and coroutines, making it easier to write comprehensive tests.

The App Size and Performance of KMP

While app size can be a concern with KMP, we have not experienced any significant increase in app size. Furthermore, the performance of our apps has improved as we have noticed faster execution times, resulting in a smoother user experience.

Challenges and Watch Outs with KMP Integration

While KMP has brought immense benefits, there are some challenges to be aware of:

  • Threading carefully with compiler plugins: It is crucial to carefully select and manage compiler plugins to avoid compatibility issues arising from upgrading libraries.
  • Considerations for testing: Testing in KMP can be slightly different, and there may be limitations when testing iOS-specific code. Utilizing appropriate testing frameworks and libraries can help overcome these challenges.

Defining the Boundary Between KMP and Client Apps

At Meetup, the boundary between KMP and client apps is defined by exposing UI state and a minimal amount of lower-level concepts. This allows for proper separation of concerns and ensures that each layer has its own responsibilities.

Implementing Custom Solutions in KMP

If a suitable KMP library is not available, we resort to implementing custom solutions. By using expect and actual constructs, we can seamlessly integrate platform-specific code into our shared codebase.

Conclusion

In conclusion, Kotlin Multi-Platform has revolutionized our development process at Meetup. By reducing code duplication, improving product resilience, and minimizing platform-specific bugs, we have seen significant improvements in our apps. We have leveraged various KMP libraries to further enhance our development workflow and deliver a better experience to our users. While challenges exist, careful consideration and utilization of appropriate tools and frameworks can help overcome these obstacles.

Most people like

Are you spending too much time looking for ai tools?
App rating
4.9
AI Tools
100k+
Trusted Users
5000+
WHY YOU SHOULD CHOOSE TOOLIFY

TOOLIFY is the best ai tool source.

Browse More Content