Building Multiplatform apps

I wondered if with Swift something like Kotlin Multiplatform is possible as well.

So that all the core logic would be written in Swift and for the UI I would use the native stack of the platform itself. Currently I'm not planning to build an app that requires a version for Apple, Android, Linux, Windows, and web. But I'm curious if someone has already some experience in creating a monorepo for all that platform that is scalable and maintainable. How much effort would this take to make that possible?

1 Like

This is basically the approach that The Browser Company has taken and applied successfully for Arc and Dia. Both are extremely large projects and it has worked quite well.

1 Like

Take a look at @keeshux's blog series about doing that with CMake, including his OSS app with all the source.

2 Likes

This exists for Android (writing Swift, and running on Android)

2 Likes

Hi Roman!

I've been doing this for a while in a decently complex app, and I would say that the approach depends on several factors stemming from your app domain. To name a few:

  1. What's your "core logic" made of? As in, is the app more UI or logic?
  2. How does your data flow? Is it UI → Core (pull) or do you also need events/callback behavior like Core → UI (push)?
  3. How asynchronous do you want it to be?
  4. Is the Core platform-agnostic or very tied to the platform differences?
  5. Do you have non-Swift dependencies?
  6. Do you use SwiftPM or CMake?

I believe the answer to these questions could make the choice of sharing Swift logic a great bet or a lot of extra work. By that, I mean that in some cases, duplicating the native code could lead, paradoxically, to less maintenance than designing a shared core that fits heterogeneous platforms and programming languages.

Ah true, is their browser closed source, right?

I would like to see an real world project repo how they set it up. Do you know any?

No, I don't think that there is anything that demonstrates that at the moment.