With the rapid development of Kotlin Multiplatform in the last couple of years, our developers were keen to use it for cross-platform projects. The idea of being able to share common code, while allowing iOS and Android developers to continue using the native tools they are familiar with, was an exciting proposition for our teams, particularly given the nature of our MyTherapy app and our partner offerings. Seweryn Plazuk, a senior iOS developer here at smartpatient, talked us through the thinking behind adopting Kotlin Multiplatform and his thoughts on how successful it has proven to be.
What was the motivation for adopting Kotlin Multiplatform?
As a developer, I think I am really keen to try new things, new technologies. So, while we were starting a new project – it was a separate feature, it was new, it didn’t have any dependencies – so it was the ideal environment to try it out.
And we decided it would be good fun and, if it worked out, something that could really benefit us in future projects.
What was it about Kotlin Multiplatform, as opposed to other platforms, that moved you in that direction?
I think the biggest thing that differentiates Kotlin Multiplatform is that it can be quite easy – certainly easier than other frameworks – to integrate with an existing project, especially one as big as MyTherapy.
It was slightly more complex to make it work with iOS than Android, they had already been using Kotlin for a while, but we managed to make it work and overcome the slight hassle.
I think it’s an exciting time to be using Kotlin Multiplatform, as well, because it is evolving so quickly. It will be interesting to reread this in the future, even in just six months, and see how things progress from the version we’re currently using [1.3.61].
How did you get to the point where Kotlin Multiplatform was a productive choice for projects?
I think I spent two sprints, so almost a month, to make it work on iOS. Kotlin Multiplatform is a relatively new solution and we had to face issues that nobody before us had faced. Furthermore, iOS project structure is based on the frameworks and horizontally separated layers of responsibilities, which did not help.
There were other challenges. Kotlin Multiplatform officially supports CocoaPods – which is a third-party dependency manager for iOS. But we couldn’t use it for MyTherapy as the project structure didn’t work well with CocoaPods, so we had to create a so-called ‘umbrella framework’. It’s basically another layer in our project structure, inside which Kotlin Multiplatform is embedded. To make it work, we created a custom Gradle script, which, depending on special, user-defined attributes, compiles a Kotlin Multiplatform iOS framework with given build configuration and symbols for targeted architecture.
How did working with Kotlin change the way you work on a day-to-day basis?
It was actually a rather big change. Usually, when planning, we talk about some edge cases and some potential solutions, and so on, but the implementation is separated when it comes to iOS and Android.
So, even if we talk about the business requirements together, we implemented the features separately on iOS and Android. With Kotlin, we could work much closer with each other and it was a nice opportunity to spot some subtle differences between the platforms and in the way we work.
Expanding on that, how has it changed the way you work alongside the Android developers?
That’s a hard one. I think now when I know a little bit more about the Android projects of MyTherapy in general and how they do work, it makes it easier to discuss technical stuff and slightly easier to discuss the potential solutions.
It’s helped us work together. I did code reviews for one of our senior Android developers, Maciej, and he did code reviews for me, which never happened before when we were coding in different languages with different platforms.
What benefits have you noticed in this ability to work closely with your Android colleagues?
It gives you a different perspective than you usually see because I will spot different things than an Android developer in the same code snippet. I think the biggest benefit in terms of code quality is that we have a single implementation, so it only needs to be tested once and it makes everything less error prone.
Has this helped make sprints more efficient?
In the beginning, quite the opposite! Of course, we were learning all of these new things, how to actually use Kotlin, how to work together, we had to figure out agreements that were previously already established on particular platforms. Since then, we have been certainly delivering things much faster.
From a personal perspective, how has learning to adapt to Kotlin and find these new solutions helped you as a developer?
For sure I have grown as a developer and have more skills, as I had never previously used this language – even if it is quite similar to Swift, which we used on iOS. Apart from learning Kotlin, I learned a lot about the project itself, about Swift and Kotlin Multiplatform compilers, and what is actually done behind the scenes with Kotlin to make it work. All of these were really cool things to learn.
“As a developer, it is great to work in a company that allows you to try new technologies. Switching to Kotlin Multiplatform is a great example of that. Having that openness is, in my opinion, a huge advantage.”
Looking ahead, what are the main projects you and the other developers are looking forward to in the coming months that might further expand your use of Kotlin?
Two of our teams, called Gold and Frost, are really into a partner project that will force us to rethink our project structure and work on vertical separation of our architecture. This is quite a big challenge and I’m really excited to see the results.
As for myself, my team is going to work on a project that heavily involves Bluetooth and everything around that, and we are thinking of using Kotlin there – although we are not 100% sure yet that it’s possible! If it is, we will use it, if not, we’ll go with the native approach. Either way, it is a cool opportunity to play with possibilities relating to Bluetooth and, hopefully, explore what else Kotlin can do.
We are hiring!
Kotlin? Swift? Whatever your weapon of choice, if you’re an iOS developer who would love to be a part of an agile and innovative team, you can help improve our award-winning MyTherapy app. Apply here:
Are you an Android developer? We haven’t forgotten about you! If you want to work on an app that truly helps people while broadening your own skillset, apply here: