293 points · by mihael · 11mo ago · 234 comments
Under the hood, projects are powered by SwifDroid, a framework I built that handles the Android application lifecycle, activities, fragments, and UI widgets (Android, AndroidX, Material, Flexbox) while automatically managing Gradle dependencies. The IDE compiles Swift, generates a full Android project ready for Android Studio.
This is the first public release. Both tooling and framework are open-source and MIT-licensed.
Then the questions is: roughly what percentage of Kotlin or Flutter apps could be writable in Swift? Today and next year?
(we're trying to do something very similar with Rust instead of Swift)
On top of that, the IDE also auto-generates required Java/Kotlin classes on the fly, for example, for Activities.
I was looking into something similar, on Flutter it uses FFIgen and JNIgen, might be something to look into on the Rust side. From what I've seen, it's quite difficult from pure Kotlin to Rust, as I was looking for the equivalent of the flutter_rust_bridge package when experimenting with Compose Multiplatform, as I have some crates I need to use, but I ultimately gave up because it was not straightforward at all.
Long ago, I took a few months, and learned Android programming (using Java, which was the native choice, back then). I ended up not really enjoying it, and eventually abandoned it, but my goal was to write fully-native Android.
I’m a big believer in fully-native development. I’ve worked with cross-platform frameworks for decades, and have never enjoyed any significant success.
For that reason, I’m a bit skeptical of the chances for this framework, but admire the work and dedication that went into it. I sincerely wish them luck.
> Most developers learn many languages during their careers and switch between them without a thought.
I’ve worked with quite a few, over my 40+ years of experience, but I don’t really “switch without a thought.” There’s always a “context switch” overhead.
For example, I am currently writing a Swift app (SwiftUI), with a PHP backend. I keep switching between the two. The biggest mistake I make in PHP, is neglecting trailing semicolons. The next-biggest mistake, is not surrounding if statement evaluations in parentheses. I've been working with PHP a lot longer than Swift, but not anywhere nearly as deeply. Swift is definitely my "native" language.
My experience is that I can learn a working understanding of a language in a couple of weeks, but it takes years to really get proficient. Think someone that speaks with a heavy accent, and someone fluent.
Also, the language is often the least relevant aspect. SDKs, stdlibs, and frameworks are where most of the work lives. They can take a long time to master, and are usually “moving targets,” undergoing constant evolution (like the language, itself).
The programming language is the most surface level detail when learning a platform.
The libraries, the frameworks, the OS services, the app lifecycle, the UI idioms are the hard part, and those cannot be abstracted away (of course you can try, but you'll end up with an inconsistent mess that doesn't feel native in any of the supported platforms, at which point you should just create a website).
It still might be, as Kotlin isn't used on the lower layers below JetPack libraries, despite Google's resistance to modern Java adoption.
I'm leaning towards Swift being the 'better' language, but even in this case, something like KMP has been around longer and is more stable.
Cross-platform frameworks I find are more about making sure that your apps stay consistent across platforms over time as they are maintained. Features land on all platforms at the same time.
I worked on a product that had been around a long time and had a separate macOS, windows, iOS, android, and web apps. It was a big a big shit-show when product leadership wanted to make large scale changes across all platforms in unison. For that product though it really did have to be native to each platform and I don't think any cross platform framework could have worked for that particular product.
Having worked with both native apps & cross-platform frameworks, I do think there is value in cross-platform frameworks as long as the framework allows you to drop down to native platform specific code easily where needed.
When it comes to mobile, I think that React Native has some serious benefits:
- Fast refresh: incredible DX improvement to be able to just save a file and instantly see the behavior of your app update without rebuilding and reinstalling. - Server-driven UI via React Server Components (still experimental): Companies like AirBnB spend a ton of engineering effort to build their own bespoke server-driven UI frameworks. Expo Router is bringing React Server Components to native apps. - Automatic deep linking: If you also ship your app for the web using Expo Web & Expo Router, then all your links work perfectly as deep links into your app because your web app and your native app have the exact same routing. If you use next.js with solito for your web app instead of Expo Router, you can also keep your web app in lock-step with your native app without having to use Expo Router for your web app. - Over the Air Updates: You can ship changes to your apps instantly without app store review. - Can drop down to native easily: These days you can easily build an expo module or if you need really high performance build a nitro module and leverage the native platform APIs where you really need it. I mean look at react-native-vision-camera, it's so much easier to use than the native camera APIs. - LLMs are way better at react than they are at swift & kotlin development.
If I wanted to build the next TikTok though I'd 100% go full native.
One of the most revered programmers in my circle, who's been coding since the early 1970's asked me once, "how many programming languages do you know?". I started rattling off a few, and he stopped me. He said "I only really know the last 2 languages I used".
Jack of all trades, master of none. If someone asked me to code in PHP, Perl or any of the dozens of languages I've used in the past today, just no way. No thank you. Yeah, I used to be very proficient with lots of languages, but no way am I going dust off those brain cells. Assembly is probably the only language I can really get into on different platforms without a huge cognitive context switch, because it's just straight forward, no kooky abstractions.
That said, I've used Javascript for front-end, back-end as well as database (mongo), and it was absolutely great to not have to context switch constantly. I've also done lots of different systems with a wide variety of other languages glued together, and it hasn't been as effortless as using one language for everything. YMMV.
I do agree a lot of people over estimate how much they know, but I work with multiple people who know at least 5 languages well.
For me myself, only counting things I’ve shipped at scale, I’d know C, C++, Swift, JavaScript, Python, Rust, MSL, HLSL, GLSL, MEL. There’s enough in common between them that I think it’s quite doable.
It is common practice to be thrown at random projects regardless of the programming project.
What is valued is the soft skills, and the ability to swim when thrown into the cold water, no matter how.
Yes it kind of sucks, however the Pandora box is long open and only an implosion of the capitalist enterprise culture would fix it.
Also, given <waves hands at everything>, I’d never consider becoming even more dependent on some big bad corp. And even if one is to put that aside somehow, Swift is a painful language … would be such a self own to have to use it even in places you’re not forced to.
Also picture this. Every time you run swift build, you get a mental image of Cook dining with Trump. It's very hard to stay focused and creative in that ecosystem rn.
The only framework i found that really bridges the gap is B4X, but you still need to have two separate projects, because of services, and #if blocks for the things the framework doesn't abstract (which, to be frank, is really just advanced uses of peripherals and libraries)
The two OS' are just so fundamentally different.
These efforts are always to celebrate, however they always end up with leaky abstractions.
Just like on the other way around one needs to be aware of Objective-C for success, or .NET/COM on Windows.
You get (1) access to JVM APIs as normal on Android, and (2) Fairly full-featured interop with ObjC, Swift and C APIs elsewhere, and (3) A pleasant language with excellent IDE support in IntelliJ.
The `expect fun` / `actual fun` stubbing for different platforms also works in a fairly low-drama way. You can also share UI with Compose Multiplatform (less mature), or just write native views.
The downside (of course) is that non-JVM targets like iOS can't use the JVM ecosystem, and most of the Kotlin ecosystem assumes Kotlin/JVM. This is slowly changing though, and isn't a structural flaw.
Also, you're going to end up with Gradle in your toolchain, which will torture your poor soul.
I agree regarding Gradle, thankfully the time I used to do Android native development is behind me, even if I keep up with Google IO sessions, and ADP Podcast.
How is Kotlin Native maturity nowadays?
There are things you might expect to be able to do trivially (e.g. formatting a timestamp into a date string) had no off-the-shelf approach last time I tried. You'd need to roll your own, or pull in an existing non-kotlin library, e.g. something from C.
I think a lot of issues stem from existing APIs being designed around Java types that will never be available without the JVM.
Thus you can do anything Metal with Objective-C and zero Swift.
Also, writing drivers, even in userspace is still mostly C++.
Going on a tangent, even if Swift isn't everywhere still, I would like that Microsoft would be half as serious as Apple, regarding .NET use on Windows, however they aren't even serious with C++.
I see - compared with SwiftCrossUI and Skip, this is SwiftUI-like but only for Android. The other two allow you to write SwiftUI or SwiftUI-like, and run on both Apple platforms + Android (or elsewhere).
SwifDroid is about native Android development in Swift. You’re not writing cross-platform UI. You’re writing Android-specific UI in Swift, using Android’s own view system and APIs directly. The goal is to enable full, idiomatic Android apps entirely in Swift, including activities, fragments, AndroidX, and Material, without touching Java, Kotlin, or XML.
While the others focus on “write UI once, run anywhere,” often with trade-offs in UX, SwifDroid focuses on writing natively for Android and having full control from Swift.
I find that IntelliJ IDEs are fine, but not nearly as amazing as they're often hyped up to be, and similarly while Xcode has problems it's not nearly as bad as is often claimed.
My experience is somewhat colored by Android Studio and JVM ecosystem stuff like gradle and proguard though, which have been more cumulative pain for me than anything Apple-side in a long time (Cocoapods was pretty gnarly but SwiftPM has fixed that).
Xcode is so sluggish it's slower than an electron app despite being native, the xcode app upload is so broken even Apple released a third party tool to bypass their own IDE and its undocumented config files look like from the 90s and do not work well with git.
The UI is sort of okay but that's not going to cut it. You can feel the decades of cruft in this IDE, it feel like using Borland.
Gradle can be a pain, but if I look at what our neighbors at the iOS team experience (constantly having to manually merge project files, not being able to simply import some libraries, ...) it's hardly a nightmare.
Specifically adding dependencies is super easy? Just specify which repo they're in (mavenCentral or Google or whatever) and add dependencies under "dependencies". When running or syncing, Gradle does the rest.
Android, iOS and “PC” all use the C ABI at their C stack level. They just have different languages available for their primary SDK.
Windows doesn’t use a C api primarily for example, so your PC example is wrong. Mac shares the same frameworks as iOS so is no more Swift/objc than iOS. It’s just that you can’t really ship electron (JIT) or easily use Qt (licensing) on iOS. But you can just as happily develop entire apps in the same C as you could on a “PC”. Case in point, blender builds for iOS.
Android is definitely the most out-there of the platforms because the jump from JNI to Java SDk is quite large but that is completely orthogonal to what you’re incorrectly claiming. Your comment is conflating completely opposite ends of the stack, but if we go by your definition, Android is Linux just as much as Linux distros on desktop.
While Windows has moved away from pure C, and nowadays has ABIs across C, C++, .NET, COM, WinRT interfaces, you can still program Windows applications in straight C.
The caveat is to only use APIs up to Windows XP, and Petzold's book to follow along.
On PC, MS-DOS did not use C, rather interrupts and there was no common C ABI.
On OS/2, a mix of C ABI and SOM, with C, C++ and Smalltalk as main languages.
Windows started only with the C ABI, nowadays it is a mix of C, C++, .NET, COM, WinRT, depending on the subsystem.
- best way of making apps last i checked was swift for ios and java for android
- i read somewhere java got replaced with something called kotlin
- then i heard they added something called flutter that works on both android and ios
- react native / "web browser based" was already a form of dev i think which was considered the most non performant solution out there
Is this swift on android another layer like the above ones? the most performant layer is always native right?
Personally I like Flutter, a lot of people, even hardcore Android native devs, say Flutter could be the way to go for Android development in general [0].
[0] https://old.reddit.com/r/androiddev/comments/1np26m4/do_othe...
The good ideas of Flutter, IMHO, got implemented in native Android (Kotlin + Compose).
Jetpack Compose and Compose Multiplatform is nowhere near what Flutter does, it's essentially still Android only as their other OS support isn't really stable, even if they say it is. I tried to make an app and gave up and went back to Flutter.
Flutter is just another cross-platform framework that happens to support Android. I think it brought good ideas that since got implemented in native Android. I am still against cross-platform frameworks anyway.
Kotlin-the-language has evolved into compiling for different targets instead of just the JVM. So with Kotlin MultiPlatform (KMP), you can compile your Kotlin code as a native executable (instead of a JVM one) or as an iOS framework. So that you can share a Kotlin library between e.g. Desktop, Android and iOS. The difference with Flutter is that KMP is not a cross-platform framework; just a way to "cross-compile" a library, if I can say. Just like you may share a C++/Rust library between iOS and Android, you can share a KMP library.
And Swift is also trying to get there, though it is less mature than Kotlin in that respect.
The advantage is that you can cherry-pick the library you want to depend on. Maybe your Swift team wrote advanced logic in Swift and it makes sense for you to call it from Kotlin instead of rewriting it, just like you may depend on a C, C++ or Rust library. And it is different from a framework like Flutter: if you go with Flutter, you write the whole app in Flutter.
My only gripe is that there is no 3D game engine for Flutter, again Dart is great, lots of solid packages like GetX just make the overall development progress as advertised.
People also sleep on the fact that Flutter can do web application and target all 3 desktops and this shit is all free without needing a 3rd party tool like Expo because the RN core experience is lacking and you need to depend on another vendor.
Yeah they're going to work on 3D afterwards (potentially, the main dev for 3D left the Flutter team and is back on Android if I recall correctly), it's not a huge priority right now. Also, it's not recommended to use GetX, there are some issues with it, a major one being it's like a framework within a framework, and it essentially rewrites a lot of Flutter. Better to use Riverpod, Bloc, Signals, ReArch or something else.
For 3D however, I've been looking at Dioxus which is in Rust, they're making a native renderer the same as Flutter (ie not webviews) called Blitz, and they're making good progress on the mobile side. This renderer can embed Bevy, a game engine also written in Rust, and Bevy can also embed Dioxus native, which I thought was really cool, it's bidirectional embedding.
I didn't know Expo explicitly made you pay, I thought it was only optional. Now that I look at it, seems like it's for high priority builds but still, can't we just build on our own servers? If not then that's a big con, I don't want to rely on an external service just to build my app.
What are you making in Flutter?
I haven't touched flutter in two years, but isn't getX a kitchen sink library disliked by everyone?
Expo is a free open source framework that costs absolutely no money to use. You do not need to pay expo any money ever.
Expo Application Services is a set of cloud services that you do not have to use to use Expo. You can set up your own on-prem build infrastructure with fastlane and never use EAS Build. You can self-host your own EAS Updates server. You don't have to use EAS Hosting for web apps. Expo is far less coupled to EAS than Next.js is to Vercel.
Flutter for the web is terrible compared to React Native Web. It's a great way to get your company sued for violating the Americans with Disabilities Act. It literally renders to a canvas almost like the Macromedia Flash apps of old. There's also React Strict Dom now which absolutely blows flutter's web support out of the water while still supporting react native: https://facebook.github.io/react-strict-dom/
I just looked up an example flutter web app and it's completely invisible to the screen reader when I enable VoiceOver: https://flokk.app/#/ . The screen reader literally announces 'web content is empty'. You can't even select text to copy it!
Also, as far as integrations with game engines:
https://github.com/calico-games/react-native-godot
If you want complex 2D graphics like you can do with flutter, react native can also use the Skia rendering engine just like flutter with react-native-skia.
I’d rather put up with the more painful DX of react native because I care more about the quality of the app vs the DX
your comparison for web is a lazy trope. If a Flutter app is invisible to VoiceOver, thats on the developer for ignoring the semantics tree, not the framework
ironically, your point on React Strict DOM actually shows how much of a mess RN web approach is. Flutter solved cross-platform consistency at the engine level years ago while React is still trying to force the DOM to behave.
I much prefer a compiled language than the runtime uncertainty of RN. composing native views sounds ideal until an iOS update changes and breaks your layout, or JS bridge chokes during a complex animation edge case that will get you digging through github issues. Flutter is rendering natively on the GPU without the overhead. I prefer shipping a consistent app over debugging why some react-native-* is dropping frames on a budget phone because of JS thread
Overall, I find your blatant marketing advertisement of Expo, very suspicious, digging through your past comments I see similar promotion of Expo and RN. You can see Expo's pricing (https://expo.dev/pricing#plan-features) which clearly shows its a classic open-core funnel scheme to get developers to build dependence and end up paying for build credits
I have years of experience building react-native apps that use Expo in CircleCI and making them available to developers in our company with Diawi without paying Expo a dime.
Saying that I'm 'suspicious' because I have a good opinion of the technology I use in my day job at a SaaS company is ridiculous.
Is it great that Flutter probably has 10x less build issues than React Native? Yeah it is. A lot of things about Flutter's DX are better than React Native. But the fact is that you can produce a way better web app with React Native Web than you can with Flutter unless complex game-esque 2d graphics are the focus of your experience.
If you rebuilt twitter's website with Flutter (it's currently react-native-web) it would 100% be a worse experience.
It's not fair to blame accessibility issues on devs and just say it's a skill issue when other frameworks give you a baseline level of accessibility for free.
react native flutter ionic
and now swift.
it seems dart + flutter still is the only way to do all targets (cli/web/iOS/android/desktop) though. react native being very close (albeit needs electron).
it surprises me that this hasn't been perfected. surely some big company would look at their balance sheet and see it's worth it even if you take a 10% performance hit on each platform, assuming you can share 90% of the code.
does swift have a good web story or is wasm the main way? desktop?
It shouldn't. It's never really been perfected across native GUI APIs after 40+ years: just various degrees of "good enough," plus fobbing it off to web stacks.
Anyhow, I've been playing with gioui, which is golang rendering in a lightweight <canvas>-like. Really nice: fast, small, cross platform GUI with just Go. Scale expectations appropriately.
Flutter is still bad on iOS and macOS. No Liquid Glass (except some weird hack attempts that look and behave badly). Liquid Glass isn't an optional decoration, it's the name of the new system-wide UI. Leaving it out of your app is like committing to iOS 6-era skeuomorphic design after iOS 7.
Edit: Several cross-platforms frameworks can do Liquid Glass:
- SwiftUI by using Skip for Android
- SwiftCrossUI
- React Native
I'm glad to see that I can finally target iOS as the first-class citizen, using Apple technologies, and then run that code on other platforms. Instead of having to use frameworks that treat iOS as secondary when it is by far the biggest money-maker for most apps.
No cross platform stack can do Liquid Glass yet. You have to wonder if that was one of design goals.
Of course it’s optional. Some of the most popular apps on the planet ignore the local UI conventions of their parent OSes entirely.
TikTok is a Flutter app. It looks identical on iOS and Android. It uses basically no native UI elements.
It’s a pretty well-known strategy to create apps that look identical on all platforms so that you lessen your customer confusion and your support burden. The fact that Spotify, Facebook, Uber, and Reddit look exactly the same no matter what platform you’re on is more important than complying with OS design guidelines and UI elements.
And I hate every one of those apps (well, back when I used Facebook, years ago, I did), because they’re just bad iOS citizens. I, as most iOS users do, don’t care what apps look on Android. For Android users, it’s the same with iOS. Making shitty cross platform apps is all about branding and saving some money for developers, nothing about the users.
This is pretty funny because you just listed SwiftUI three times but in different configurations. They're not truly cross platform, they just wrap Apple's native design code. In contrast, I can (and do) use a package like liquid_glass_renderer to get Liquid Glass everywhere, on all my devices, with one codebase.
Maybe it will get there... Meanwhile I would rather use technologies that provide the full experience on the platform where it matters, and would never want those liquid components on platforms like Android or Windows anyway.
Disclaimer: I have seen teams writing mobile apps in Qt, and it was systematically a lot slower to develop, with a lot of pain, and resulting in worse apps. Even if you only have C++ devs, I would argue that it may be worth giving them the time to learn a modern language and write the mobile app with it.
I'd love if you could also contact me (my socials are in my profile) as I'm developing a set of components to help exactly in that situation.
It also inherits all of the bad parts of the JVM. Crappy build tooling (gradle), and then the slow startup and high memory usage.
The main thing though is that Dart has pub.dev and a CLI that makes it extremely easy to add packages, via `dart pub add`. If I do want to go more of a functional route I'll just use Rust instead, it has all of what Kotlin has and more, plus a similar streamlined package management as Dart in the form of `cargo add`.
There's been a trend of improved DX for languages used in app development:
ObjC -> Swift
Java -> Kotlin
Javascript -> Typescript
...Dart feels like the before with no after, even though it got traction in the era of the Afters.
Regarding KMP specifically, I didn't find it much use to only write business logic in one language, while still having to rewrite the UI up to 6 times (mobile, web, desktop), I'd rather have everything all in one.
Compose Multiplatform looks promising as it's Flutter-like in that it renders its own UI but it's still quite early, I know they say it's "stable" but when I used it, it really didn't seem so, plus the package support is extremely lacking compared to Flutter and of course the behemoth that is React (and Native)'s npm.
These days I'm looking forward to Dioxus, they're making their own native renderer similar to Flutter but especially for web, they are not doing the canvas trick, because they actually use plain HTML and CSS as their markup languages so they can compile directly to browser standards sites while still having a non-webview experience on mobile and desktop.