Quick question, our Kotlin / CfD code can be expor...
# compose-desktop
k
Quick question, our Kotlin / CfD code can be exported to Android and iOS apps? With all the right background config I haven't learnt yet, I guess, but possible or not?
Just thinking of Android and iOS apps initially, but be good to extend a CfD program to mobile down the track.
d
It's not an all or nothing answer 😊 Compose multiplatform will, today, let you share a significant amount of the View Declarations between Desktop and Mobile. iOS is not there at all yet, but is coming in the near future.
So things like images loading mechanisms will be different between Desktop and Android
And often the most desirable layout will be different; desktop offering more screen real estate.
👍🏻 1
So you'd probably find yourself mixing and matching some of your shared code in actual Desktop and Android targets.
This is not a bad thing; it's Compose Multiplatforms greatest strength.
Share the stuff that can easily be the same, specialise where the platform does.
👍🏻 1
k
Hey mate! Thanks for all that info! Good to know. Just seeing requests to developers of Android apps we use, saying "Hey where's the iOS app?" and thought if I could build on a base now that I could deliver to all those in some form would be great. Even if there had to be differences between versions.
So it's not yet possible to output to iOS, but it's being worked on? I'm in no hurry for it, because it's going to be just a whole other thing to learn, and I've got enough to work with already!
m
The real question for me is how many JVM dependencies do you still have in your code. That’s no problem for desktop, sometimes a minor problem for Android (but mostly not) but a huge problem when adding iOS to the party. I use a lot of such external JVM libraries which I cannot easily replace with anything else. So even if iOS support will be available shortly it will still remain an unreachable target for me with the current technology stack.
d
Yes very good point @Michael Paus, if iOS is on the agenda at all you'd probably want to start positioning for it by using a 'multiplatform ready' stack of dependencies e.g. Ktor HTTP client and kotlinx.serialization where iOS support exists.
k
Thank you! Good info to be aware of. Just what I need.
So would I need a macOS machine to build iOS apps, or not?
d
Yes
👍🏻 1
m
@darkmoon_uk That’s how most people seem to argue in this discussion but I think this will often fail for bigger apps. Using Ktor or Kotlin serialization is not the problem. The problem are large legacy software libraries and special purpose mathematical or other scientific libraries which have been developed over many years and which cannot simply be replaced by anything. At least not with a still acceptable effort. I think this is an aspect which is completely overlooked. That’s why I put more hope into GraalVM/native-image which avoids this problem by just compiling these libraries and the necessary runtime code into the corresponding native code. This could be done with Compose apps as well if one wanted to. And don’t tell me that all the business logic will always reside on some server anyway and so you just don’t have to care. That’s also not true or would you like to use some mission critical app which becomes completely defunct if you don’t have a network connection for a while?
@Kebbin You’l need a macOS machine but you don’t necessarily have to own one. You could do the build on a macOS GitHub runner for example. But at least at the beginning the necessary setup is probably too cumbersome.
👍🏻 1