Mobile App Development with Kotlin Multiplatform

Front-end Engineering Solution

context​

In the world of mobile development, developers often find themselves having to choose between native and hybrid approaches to creating applications. Native development, which involves the use of specific languages and tools for each platform (such as Swift for iOS and Kotlin for Android), guarantees optimal performance and full access to the device’s features. However, this approach implies a greater effort in terms of time and resources, given that separate code must be written and maintained for each platform.

On the other hand, hybrid frameworks, such as React Native, Flutter or other solutions, try to reduce this overhead, allowing a single code base to be written. Although this solution offers greater efficiency and centralized code management, it can involve compromises in terms of performance and flexibility.

Kotlin Multiplatform (KMP) represents a middle ground between these approaches, proposing a solution that allows you to write a shared codebase for different platforms without sacrificing performance or native access to device APIs. It allows you to share code between different targets such as Android, iOS, Web and Desktop, using Kotlin and significantly reduces the time and effort required to develop and maintain cross-platform applications.

kotlin multiplatform

PAIN POINTs

  • Duplication of code: Writing a native app requires the duplication of business logic and related tests, creating potential bugs and affecting maintenance
  • Hybrid competitors force the developer to use their tools and languages and do not guarantee updates and full compatibility with native hardware and functionalities
  • Hybrid competitors may be discontinued and require the entire application to be rewritten (see Xamarin Forms)
  • The performance of competitors is considered inferior to native
  • The development effort of native applications is greater than that of hybrid applications

solution

By creating a solution in Kotlin Multiplatform, it is possible to share the entire logic of an entire application excluding the UI, which can be written natively. This allows you to maintain continuity with the user experience that the user usually has with the reference operating system, customize the design by choosing whether to use native or ad hoc components, and use the latest native technologies available. Furthermore, it allows the user to maintain compatibility and retrieve and reuse components from and for different native applications

The code is compiled for the target platform without an intermediary, excluding the overhead of interpreters. For iOS, the generated code is a framework in Objective C, and recently also in Swift (beta version), which can be extracted and used as a library, importing it into the projects of interest.

A single codebase for the business part reduces the errors of double implementation in different platforms and makes everything highly testable. In fact, it is possible to write unit tests – integration tests and e2e tests and run them in the common codebase.

There are no constraints to the support of native libraries as it is possible to delegate the implementation to the native part, should there be difficulties with KMP integration.

benefits

  • Code sharing: Maintain a common codebase across different platforms, reducing duplication and simplifying development
  • Better UI/UX: Guarantee uniform user experiences while respecting the specificities of the platforms
  • Code testability: Quickly increase test code coverage
  • Migration of existing applications: Plan a migration of a native Android project to Kotlin Multiplatform
Technology Stack and Key Skills​

 

  • Kotlin Multiplatform: to share the business logic between platforms and maximize code reuse and reduce duplication
  • Native Development:
    • Kotlin for Android: Implement the user interface and platform-specific features
    • Swift for iOS: Implement the user interface and platform-specific features
    • Guarantee of a native user experience and high performance
  • Testing:
    • JUnit: Unit and integration tests
    • XCTest: UI tests
    • Guarantee of application quality and reliability on both platforms

Do you want to know more about our services? Fill in the form and schedule a meeting with our team!