Using Vertex AI in a Compose/Kotlin Multiplatform project

The general availability of Vertex AI in Firebase was announced recently and in this article we’ll show how to use the associated Android and iOS SDKs in a Compose/Kotlin Multiplatform project. The code shown is included in the VertexAI-KMP-Sample repository. [Read More]

Using kotlin-inject in a Kotlin/Compose Multiplatform project

I’ve been using Koin in most of the Kotlin Multiplatform (KMP) samples I have but thought it would be good to include use of at least one other DI framework and this article outlines changes made to add kotlin-inject to the BikeShare KMP sample. This project retrieves data from a... [Read More]

Consuming Jetpack Paging KMP code in SwiftUI and Compose clients

This week saw the first Kotlin Multiplatform (KMP) stable release of the Jetpack Paging library (following on from a flurry of Jetpack KMP related announcements recently!). In this article I’m going to outline changes made to add use of that library to the Morty KMP sample and in particular show... [Read More]

Using Jetpack Room in Kotlin Multiplatform shared code

Google and JetBrains have been combining to make many of the previously Android only Jetpack libraries work in Kotlin Multiplatform (KMP) code. We had seen releases of Lifecycle, ViewModel, DataStore and Navigation and as of earlier this week Room is also now available. Exciting times! In this article I’m going... [Read More]

Displaying Charts on iOS, Android, and Desktop using Compose Multiplatform

The increasing number of libraries that support Compose Multiplatform has been an important factor in the widening interest in that ecosystem. One of those libraries is the KoalaPlot charting library which I had been trying out in the Android and Desktop Compose clients that are part of the FantasyPremierLeague Kotlin... [Read More]

Using Compose for a UI component in a SwiftUI screen

The following recent Twitter poll captures what I believe are the main options available when using Compose in an iOS SwiftUI application. About a year ago I tried out early version of Compose for iOS in PeopleInSpace sample for the complete iOS app. More recently I explored using it for... [Read More]

Consuming Compose for iOS in a SwiftUI application

Most of the Kotlin Mutliplatform samples I’ve created have focussed on the sharing of non-UI code and have included a fully SwiftUI based iOS client, along primarily with Compose clients for the other platforms (e.g. Android, Wear, Desktop, and Web). In the PeopleInSpace sample I also created, some time ago,... [Read More]

Using KMM-ViewModel library to share VM between iOS and Android

A frequent question when using KMM (Kotlin Multiplatform Mobile) is firstly whether to share the view model between the iOS and Android clients and, if doing so, how best to do it in a way that still stays true to each platform’s approach to lifecycle, concurrency and observability. I’ve tended... [Read More]

Swift/Kotlin ViewModel alignment in a Kotlin Multiplatform project

In the Declarative UI world we live in today a ViewModel typically acts (among other things) as a container of observable UI state, changes to which will cause the appropriate parts of the UI to be re-rendered. This UI state is frequently derived from different pieces of information coming from... [Read More]

Using new Swift Async Algorithms package to close the gap on Combine

As developers have started adopting the new Swift Concurrency functionality introduced in Swift 5.5, a key area of interest has been around how this works with the Combine framework and how much of existing Combine based functionality can be replaced with async/await, AsyncSequence etc based code. In particular there has... [Read More]

Using Google Maps in a Jetpack Compose app - Part 2!

In a previous article back in July of 2020 I outlined how Google Maps support could be added to a Jetpack Compose app based on what was available at that time (using AndroidView). I mentioned in that article that it “seems like this is something that ultimately will exist as... [Read More]

Exploring new AWS SDK for Kotlin

There was announcement recently about the availability of the Developer Preview of AWS SDK for Kotlin. This post outlines initial exploration done to use the SDK, and in particular the DynamoDB APIs, in the PeopleInSpace Kotlin Multiplatform project. [Read More]

Using different Kotlin versions in a KMM project

More and more Kotlin Multiplafrom projects are now using Jetpack Compose for the Android UI and with that comes the potential inconvenience that Compose (including recent stable version) still depends on Kotlin 1.5.10 while a number of libraries typically used in KMM projects (such as Kotlinx Serialization and Ktor) are... [Read More]

Using Swift's new async/await when invoking Kotlin Multiplatform code

One of the biggest, and probably most anticipated, announcement at WWDC last week was regarding Swift 5.5’s new concurrency features and, in particular, its new async/await mechanism. This would appear to work in a way that’s very similar to Kotlin Coroutines which should I believe make Swift based async development... [Read More]

Using Realm persistence library in a Kotlin Multiplatform project

It’s always great to see the Kotlin Multiplatform (KMP) library ecosystem continuing to grow and a relatively new addition to that is Realm which describes itself as “a mobile database that runs directly inside phones, tablets or wearables.” and “a replacement for SQLite & ORMs”. An added positive is fact... [Read More]

Using Swift Packages in a Kotlin Multiplatform project

When using Kotlin Multiplatform, the Kotlin/Native compiler produces a framework for iOS/macOS corresponding to the shared code module (am assuming single module for purposes of this discussion). A number of different approaches are used then to ensure that the XCode project is wired up to use that framework and that... [Read More]

Jetpack Compose and GraphQL, a very merry combination!

There are a number of ways in which Android and iOS development is “converging” at the moment but I think the most exciting area is the adoption of Declarative UI frameworks on both platforms -SwiftUI on iOS and Jetpack Compose on Android. As such, my interest is always piqued, when... [Read More]

Comparing use of LiveData and StateFlow in a Jetpack Compose project

I recently updated PeopleInSpace project to make use of Kotlin Flow in shared multiplatform code to poll for the position of the International Space Station (ISS). As part of that work I had initially updated PeopleInSpaceViewModel in the Android app to use StateFlow (along with stateIn()) instead of LiveData. However... [Read More]

Jetpack Compose for the Desktop!

There have been indications in recent times of changes being made that would allow use of Jetpack Compose to develop UI for desktop apps. That became closer to reality today when it was noticed that EAP version of IntelliJ IDE has option now to create projects that target use of... [Read More]

Exploring use of StateFlow in a Kotlin Multiplatform project

Kotlinx Coroutines recently introduced the StateFlow API, described as “A Flow that represents a read-only state with a single updatable data value that emits updates to the value to its collectors”. This is generally seen as a replacement for LiveData on Android but also, importantly, something that can be used... [Read More]

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... [Read More]

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... [Read More]

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! [Read More]

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... [Read More]

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... [Read More]

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... [Read More]

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... [Read More]

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... [Read More]

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... [Read More]

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... [Read More]