90 points · by andraskindler · 8y ago · 36 comments
And going the other way, there's been noise for a couple years that Android apps could be written in Swift, achieving the same effect in reverse.
How is this different for Xamarin? C# has first class support on Windows.
While still in Preview, Xamarin.Forms actually supports Linux with Gtk#, Windows with WPF and UWP and Mac with Cocoa (actually Cocoa with C# does work really well).
I recently built a kotlin Android app for work, and our architecture is tightly coupled to Android's Room database and LiveData objects. Obviously if we build it to be cross platform we wouldn't be able to use a Room database or LiveData objects on an iOS device. Would we have to roll our own persistence layer in a cross platform application? Or would we share business logic but still write a persistence layer using platform specific code?
It's not just persistence too. Any lower level API provided by the platform would still need to be written twice, right? Accessing the camera, the devices GPS location, or anything hardware related still needs an implementation for both platforms. Or would we eventually see libraries that would abstract this layer out, similar to react native?
Edit: Another thought...I haven't done much iOS development but the whole async nature of Android apps with the UI thread and background threads also seems like it would be a nightmare to deal with in a cross platform way. Does iOS involve a lot of async threads?
We are already using libraries to make easier to use background threads (RxJava, RxSwift) so I don't think it's that hard to implement a cross platform lib for that purpose. JetBrains is already trying to tackle the task with Coroutines for Kotlin Native: https://github.com/Kotlin/kotlinx.coroutines/tree/master/nat...
How you think is possible to use swift on android? The only almost decent way is https://www.elementscompiler.com/elements/default.aspx and is not enough:
https://www.reddit.com/r/swift/comments/8zb9y1/state_of_swif...
The developer experience with the NDK is quite bad, as if Google makes it on purpose for only the persistent developers to actually succeed at it.
In a nutshell this has the same limitation has Xamarin.
The Business Logic is shared , but the UI Logic and the Technical Logic aren't shared or not completely.
The Xamarin community has been struggling with this issue for half a decade and they ended up re-writting their own rendering engine[0] (similar to Flutter) in C# on top of Xamarin to obtain truly MVVM Cross-Platform Framework.
My point here is very simple , getting Kotlin to run on iOS is great, but it's somewhat a waste of time because of how much time and effort it would talk to create a Runtime or Rendering Engine to normalize UI/UX on differents platforms.
Part of the issue when evaluating frameworks is expectations and not understand the plusses/minuses. If you are looking for a framework that will do 1 codebase for all logic and UI, without sacrificing any UX or capabilities, you'll probably be let down. Kotlin Multiplatform will be great for sharing logic and architecture. UI is somewhat of a different case. Why Xamarin wasn't great here is you need to do EVERYTHING in Xamarin, and write custom bridge code when not. It's an entirely different world, which bad IDE support for most of it's history. Jetbrains makes excellent tools, and if you understand that the UI will be "native", then there's a lot of efficiencies you can leverage here. If you get frustrated because you can't make one thing do all things, then yeah, it'll let you down.
Anyway, yeah, they're different.