Using Kodein-DB NoSQL database in a Kotlin Multiplatform project

A big factor in the increasing adoption of Kotlin Multiplatform is the ever growing number of KMP libraries that are becoming available. A new addition to this list, albeit in beta right now, is Kodein-DB, described as an “embedded NoSQL indexed document database for Android, iOS, and client JVM”. In this post I’m going to describe what was involved in adding initial use of Kodein-DB to BikeShare project.

Using Google Maps in a Jetpack Compose app

I’m in process of migrating Galway Bus over to use Jetpack Compose and one particular requirement is the ability to show bus stops (and also bus positions) on a Google Map. It seems like this is something that ultimately will exist as specific Jetpack Compose @Composable but for now it looks like only way to add a map like this is using AndroidView.

Using Koin in a Kotlin Multiplatform Project

The options for adding dependency injection to a Kotlin Multiplatform project have up to now been pretty limited and if, like me, you’ve been using Koin for your Android projects then you’ll have been excited to see following announcement earlier today!

PeopleInSpace hits the web with Kotlin/JS and React

Next up on our Kotlin Multiplatform journey I thought it would be interesting to look at bringing PeopleInSpace to the web….using Kotlin/JS and making use of same Kotlin shared code that we’ve used on other platforms. In line with project in general we’re going to make the minimum changes needed to support this (these posts are primarily aimed at (a) giving people a “flavor” of what’s possible, and (b) providing minimal setup needed to get someone up and running using particular technology). Note also that this is heavily inspired by this excellent Kotlin/JS codelab.

Kotlin Multiplatform running on macOS

Most of the focus of Kotlin Multiplatform has, understandably, been on targeting the development of apps that run on Android and iOS. However, other platforms are supported so when I saw following announcement of SQLDelight’s support for macOS I was curious to see what would be involved in developing a basic app on that platform that uses same shared Kotlin code used in PeopleInSpace (A little bit more background on initial effort working with Android and iOS in following post Minimal Kotlin Multiplatform project using Compose and SwiftUI)

Adding some Storage (to) Space

So, in previous post (Minimal Kotlin Multiplatform project using Compose and SwiftUI) I gave brief overview of PeopleInSpace, a small repository that was designed to illustrate key moving parts of a Kotlin Multiplatform project (running on Android, iOS, and later, watchOS). However, although I’m reluctant to add much else to the project, one key gap was around locally persisting the data we got back from remote server. The somewhat serendipitous combination of following activities in last few weeks also provided further encouragement to add such functionality to the project (1) Neal’s addition of watchOS support to PeopleInSpace, and (2) watchOS support was added to SQLDelight (Kotlin Multiplatform persistence library).

Minimal Kotlin Multiplatform project using Compose and SwiftUI

In previous posts I’ve used GalwayBus repo to illustrate results of various explorations I’ve done in to the use of Kotlin Multiplatform. However I thought there’d be value in creating a more minimal project that would allow clearer illustration of key moving parts of a multiplatform project and thus PeopleInSpace was created. It also provided opportunity to try out use of Jetpack Compose for the Android app (with UI being developed on iOS using SwiftUI - using pretty much same approach outlined in SwiftUI meets Kotlin Multiplatform!).

Exploring SQLDelight Flow support

In Introduction to Multiplatform Persistence with SQLDelight it was mentioned that we still needed way to “manage observing of data updates (some interesting work being done on extension that supports Kotlin Coroutines Flow)”. Well, not long after that SQLDelight 1.1.4 was released with the aforementioned Flow support and this post gives short overview of exploration done to start using it.

Introduction to Multiplatform Persistence with SQLDelight

Most mobile apps store data locally on the device. This could just be some local settings/preferences but frequently also includes caching of data returned from queries to back end services. For at least the latter case that data is typically stored in an SQLite database (and, importantly, SQLite is used on both iOS and Android). There are low level libraries available to access SQLite database but this is normally achieved using libraries that provide a higher level abstraction….these typically being Core Data on iOS and, at least more recently, Room Persistence Library on Android.

SwiftUI meets Kotlin Multiplatform!

Announced at WWDC last week, SwiftUI is a new declarative UI framework that is described as an “innovative, exceptionally simple way to build user interfaces across all Apple platforms with the power of Swift.”. This approach to UI development has been popularised recently with emergence of Flutter, something that was also likely the inspiration for Jetpack Compose which was announced at Google I/O a few weeks back (SwiftUI appears to be at a significantly more advanced state of maturity than Jetpack Compose and is available to try out in Xcode 11 beta…but also important to note that it does require iOS 13).