Skip to content
  • Blog

Our Next Step in Multiplatform Application Development: Trikot

October 18 - 19

Martin Gagnon
Partner, Director ⏤ Technological Exploration

Mirego’s team puts user experience first in developing products. Fluidity, performance, ergonomy, respect of the platform guidelines, and maintainability are priorities when selecting technologies. 

In ensuring the delivery of high-quality products, we need to adapt and polish the UI, but also the navigation and background task management on every platform. This is why we don’t only work from a mobile-first approach but, equally, native-first.

Over the past six years, we’ve become experts at sharing code between web, mobile and TV platforms, while never losing our focus on native user experience. Scratch, a library developed in-house, leveraged the Java to Objective-C transpiler made by Google (j2objc) and the Java to Javascript transpiler (j2js) made by Mirego. In its infancy, Scratch was limited to assemble data received from the server and pass it to the native code. Over time, it became a reactive programming framework for mobile and web applications.

Today, Scratch allows us to keep development and maintenance costs in check, while retaining all the benefits of native applications. However, over the past six years, native frameworks have evolved. Since we’ve started Scratch, Apple decided to adopt Swift as its primary programming language, Google adopted Kotlin and now favours it, and the support for modern Javascript has dramatically improved in all browsers.

In 2018, we started re-evaluating our options for multiplatform development. The emerging solutions at the time were React Native and Flutter. We ended up rejecting them for reasons of performance, maturity, or because they didn’t allow our team to tailor applications to each platform. Most of the solutions also required adding a new programming language to the mix, adding a new programming environment and thus, a level of complexity when interacting directly with the platform. As Airbnb mentions in their blog post, this limitation is very present in React Native applications.

Kotlin Multiplatform is developed and maintained by the Kotlin community with the support of JetBrains and Google. It offers the same benefits we had using Scratch and allowed a natural interaction between Swift and Javascript. Client strategy more often than not requires that we deploy products on more than one platform, and well beyond mobile. Kotlin Multiplatform can be used to create shared code on iOS, tvOS, iPadOS, Android, Android TV, Web, WebAssembly, Windows, macOS and Linux, granting that the shared code will behave the same on every platform.

Kotlin is Android’s primary language. It allows us to write functionality using both Kotlin Multiplatform and the Android SDK naturally and then integrate the shared logic on other platforms. On top of this, Kotlin Multiplatform is supported directly in App Code, a JetBrain IDE, allowing Swift and Kotlin development in parallel. Not unlike j2objc, Kotlin Multiplatform offers a lower-level solution compared to most other solutions on the market. This required the Mirego team to develop a higher-level library to accelerate multiplatform development. We named it Trikot.

When using Trikot, the shared code is imported by the native code. In a sense, it is the native code that forms the application’s outer shell. It then imports Trikot as its inner layer to create an interface between the platform and the shared code at its core. All of the common logic shared by every platform is contained within that core. Trikot handles all the data flows between the native and shared code. This explains why the first module we’ve developed within Trikot is an implementation of Reactive Streams for Kotlin Multiplatform. The native platform expert could then create a platform optimized UI, encryption module, Bluetooth interface or background task scheduler using the native language and SDK and connect it to the business logic in the application’s core.

The technologies used to build digital products evolve extremely quickly, and our products must keep pace. By isolating the business logic from the different platforms, we allow our products to immediately benefit from the new technologies available on any of the platforms supported by Kotlin Multiplatform.

Today, we proudly take the next step in Kotlin Multiplatform’s adoption and giving back to the Kotlin community by releasing Trikot’s first open-source module: Trikot.streams.

00:00
00:00

En français SVP !