CocktailApp is a Kotlin multiplatform (KMM) app for technology and exploring new programming possibilities. It allows you to browse drink recipes from TheCocktailDB database, and it’s based on the modern Kotlin Multiplatform framework, ensuring smooth operation on both Android and iOS.

I took up creating such an application to experiment with Swift and SwiftUI. I came across a simple API with a database of various drinks and their photos, which seemed like the perfect case to test a new technology, framework and environment. By the way, I wanted to see how Kotlin Multiplatform handles cross-platform projects and test some interesting libraries, such as Room multiplatform. In addition to testing new technologies, I also wanted to expand my knowledge about repository management. I used code formatters such as ktlint and swift-format along with a pre-commit hook.

My impressions of using Kotlin Multiplatform Mobile (KMM) in conjunction with Swift are mostly positive. For someone who previously focused mainly on developing Android apps, KMM has significantly eased the entry into a new ecosystem and reduced the time needed to learn the specifics of the iOS environment. However, it has not been without its challenges – one area for improvement is the sealed classes mechanism. I often use the Result class, based on Philipp Lackner’s approach to handling one-time events. Unfortunately, in Swift, translating this mechanism does not always work perfectly, because the equivalent of sealed classes can be considered an enumeration type, which requires additional modifications and complicates the code somewhat. Despite these difficulties, KMM definitely speeds things up and gives consistency across platforms.

Room has long been well known in the Android community as a proven SQLite data storage tool. Before starting the project, I noticed that the Android team was working on a multiplatform version of Room, which piqued my interest. However, the question arises – is it worth using?

For a production environment, definitely not yet, as the multiplatform version is still in alpha stage. Various problems can be encountered during operation, such as compilation errors, even though the database itself works fine. In my case, I was using version 2.7.0-alpha06. Despite its promising capabilities, the current state of the library indicates that it is best suited for experimentation and learning rather than production use for now.

Latest Articles

Contact Form