3 ms·
> I have been trying to get my feet wet in mobile development I know the title suggests cross-platform frameworks, but let me give my opinion: go native. For A
by palata 3y ago
> I have been trying to get my feet wet in mobile development
I know the title suggests cross-platform frameworks, but let me give my opinion: go native. For Android, Kotlin + Jetpack Compose. For iOS, Swift + SwiftUI.
Now let me elaborate on my opinion: Cross-platform doesn't work well across devices types. A desktop screen is fundamentally different from a phone screen (one is a big screen controlled with mouse + keyboard, the other is touch on a small screen). All the cross-platform apps I have seen trying to get both Desktop and Mobile are weird in some way: it's just the worst of both worlds.
Now let's say you only want to target Mobile. Then suddenly it's "some cross-platform framework" vs "2 native apps (iOS + Android)". It may seem like cross-platform means "write once", which would be half the time of writing two apps. But that's not the case. Cross-platform is more "write once, debug everywhere". And debugging is not fun, the fun part is to write the app. Kotlin and Jetpack Compose are super cool, Swift and SwiftUI too. Just choose one, and then if your app needs it, learn the other.
Here are a few problems that I have seen with cross-platform frameworks for mobile dev:
- There are huge communities for Android and iOS. Much better than any cross-platform framework. So you are more likely to get help there.
- Cross-platform is annoying: develop for Android, then test on iOS and find bugs. Fix them, test on Android and find that your fixes just broke Android. Fix that, and go back testing for iOS.
- Cross-platform is a tradeoff: either you have to use what's exactly common between Android/iOS, or you have to do some kind of `if (android) elseif (iOS)` (which sucks).
- With cross-platform, as soon as you do something that is not just showing an image and a text, you will hit differences between the platforms: the UI is different between Android and iOS, which one do you want to choose? Permissions work differently. The filesystem works differently. WiFi, Bluetooth, all that. Wanna have a database? You'll quickly need to learn how it works on both platforms. Preferences? Same thing.
In my experience, Flutter is the nicest cross-platform framework I have used. However it's not as nice as native (smaller community, they regularly break the conventions/API (we are at Flutter v3, right?)). Also with Flutter you quickly end up writing plugins where you write your code twice (Android + iOS) and interface it in Dart. So instead of Kotlin + Swift, you now have Kotlin, Swift and Dart, which is not better. Also I am convinced that Flutter will always be a second-class citizen on iOS. If you want to try Flutter, don't do it on Android (because of course that will work better there). Try it on iOS, and see if it is bearable. I found it painful.
As for the web frameworks... IMHO web development should stick to websites :-). Let's write proper Desktop and Mobile apps for Desktop and Mobile, and keep web development for websites.
Conclusion: unless your app is super, super simple, you will be better off with native Android/iOS. And if your app is super, super simple, that's a reason to go native Android/iOS, because that's a simple app to get started!
- wdb 3y agoYou can share the business logic between platforms but the UI is what will be platform specific. That’s how I have been doing it for years. Works really well. But I never liked apps that looked like an Android app on iOS or the other way around.
- palata 3y ago> You can share the business logic between platforms but the UI is what will be platform specific. I don't disagree, but it depends a ton on what the business logic is. If you want to use the filesystem, or the permission system, or WiFi, Bluetooth, etc, then quickly it becomes platform specific. Say you need some OpenCV or GStreamer, to me it makes sense to use C/C++ (with a nice API to link to Kotlin/Swift) and share that. But many apps don't go that far. > But I never liked apps that looked like an Android app on iOS or the other way around. Totally with you here.
- bingemaker 3y agoThanks for the detailed explanation. Based on your experience, is it possible to start with cross-platform frameworks while the app is simple, and then rewrite (ahem) or gradually move to Android and iOS development? One issue that I see is: I need to learn both Kotlin and Swift as opposed to Dart. I wonder how much of a learning curve that would be? With respect to web frameworks, I totally agree. Web dev is much more fun.
- palata 3y ago> One issue that I see is: I need to learn both Kotlin and Swift as opposed to Dart. With Flutter, unless everything you want already exists, then you will have to do some Kotlin and Swift (when writing your plugins). One question I always ask is: do you really need both Android and iOS? Can't you just start with one? If you start with Flutter and then rewrite in Android/iOS, that's 3 apps. If you start with Android and then add iOS, that's 2 apps. I know people want the cheapest ("I only want to learn Dart"), but the best is usually not the cheapest. IMO, just start with Android/iOS, and continue from there.