Categories
Architecture JSON Kotlin Kotlin Multiplatform MacOS

Kotlin Multiplatform in a MacOS app

If a Kotlin developer is familiar with her libraries and language paradigms, it might seem superfluous to learn their counterparts in Mac development. There comes in the possibility to use Kotlin Multiplatform(KMP) in a MacOS app, where familiar libraries and language can be used to generate a .framework, which in turn can be used in […]

Categories
Apps Architecture Kotlin Multiplatform Mobile

Kotlin Multiplatform app architectures

The recommended architecture for Android development is MVVM. However, when using Kotlin Multiplatform Mobile(KMM), the Jetpack’s ViewModel is not available. This means a different dependency or architecture needs to be used. There is no official way to go about this, but thanks to the Kotlin community, different approaches have surfaced. Separation of concerns The purpose […]

Categories
Architecture Kotlin

Kotlin Hydra constructors

After 4 years of Kotlin experience, one of the confusing parts still are the constructors. It appears like every time they seem figured out, you still find yourself googling for a solution in the next project. Compared to Java’s relatively straightforward definitions, Kotlin constructors are like Hydra’s heads. After understanding one concept about them, another […]

Categories
Android Crypto Java Kotlin

Java EC crypto with BouncyCastle

Java crypto is like an architect building a house. Architect only knows how to design a house, but needs a construction company to actually build it. In Java, only crypto interface is defined, and a provider is required to actually implement the methods. There are different providers, but one has stood out in the test […]

Categories
Android Apps Architecture iOS Multiplatform Mobile

Kotlin Multiplatform logging libraries

When developing with any platform, the existence of libraries is assumed. This is to delegate common tasks to out project code, in order to reduce development time and avoid common pitfalls already solved by other developers. Kotlin Multiplatform(KMM) is no different. Available libraries Since Kotlin is becoming more popular among Android/JVM developers, one might expect […]

Categories
Apps Kotlin Multiplatform Mobile

iOS app with Kotlin Multiplatform Mobile

Overview Kotlin Multiplatform Mobile(KMM) is a new feature from Jetbrains. It is an alpha feature but can already be used to create and publish apps for both iOS and Android. It is possible to write business (network and database) logic in Kotlin, and share this code between iOS and Android. ⛩Architecture Kotlin code compiles into […]

Categories
Kotlin

Create JSON manually with kotlinx.serialization

Kotlin serialization is a great library for serialisation in Kotlin. It is mainly geared towards serialising from objects to strings and back, but on closer look it also contains a comprehensive Json library. Even after discovering the documentation, though, the use of this new library might be confusing. 🕋 Serialisation to objects Consider a data […]

Categories
Android Architecture Kotlin testing

Logging in a Java library

It can be useful to emit logs in a library. When doing so, one needs to consider when to emit, how to filter and who is responsible for printing/handling the logs. Correct logging should also be tested. When to log There are different reasons to emit a message, for instance on important events, undefined behaviour […]

Categories
Kotlin

Kotlin: Concatenating nullable strings

A null String is concatenated as “null” in Kotlin: What if the goal is to concatenate only if the second string is not null? There are a few options: if-else One of the solutions would be to check the null value with elvis(?:) operator: Now there is no “null”, but the whole “and second is” […]