Hacker News new | ask | show | jobs
by FlyingSnake 3507 days ago
iOS developer with multiple years of experience of burning fingers in cross-platform development here.

I've tried Cordova/Ionic, Xamarin, Dropbox Djinni, and native iOS development. C++ is the closest I've got the a performant cross-platform solution, even though it go it's own quirks.

The problem with Xamarin is it'll always play second fiddle to quick moving targets of Android and iOS toolchains. In my case the Reactive Extensions support was utterly broken, and Visual Studio kept crashing on MvvmCross, Android SDK updates would make things hell, and I would waste at least 8 hours a week to fight the toolchain. The promise of cross-platform doesn't deliver much as you're trying to tweak your MVVM solution to Android/iOSs whims and fancies, which leave you with a fragile common logic.

If you want to write a TODO list of simple CRUD app, it might work, but for professional iOS/Android development, Xamarin is not enough. Xamarin doesn't free you from learning ViewController lifecycle etc and platform specific implementation details. So you're stuck on a foreign platform, with extra overload of learning C#/F# along with Android/iOS platform overhead.

My Advice: Learn Swift and Kotlin, and do native development. Cross-Platform is a illusion, and the road is paved with dead and failed projects.

5 comments

Thanks for the input. I do feel more and more that cross-Platform is a illusion like you say.

I already know Swift. Do you think Kotlin would a better transition into Android than straight up Java?

Kotlin is a breeze compared to Java, and it's conceptually similar to Swift (syntax, null safety, type inference etc). I love Kotlin but it's not with it's own quirks.

I would love to see a true cross-platform solution, but honestly it's a dead end in my experience. I would say C++ comes close, but I wouldn't be surprised if people feel unwelcome due to it's syntax and quirks.

I do feel more and more that cross-Platform is a illusion like you say.

As it has always been, my son. I've been hearing the wonders of cross-platform for going on three decades. Be it Unix->MS-DOS, Java on anything, or iOS->Android, there is always a compromise. Prior, it was usually that the app that didn't look native on any of the platforms. These days it seems the compromise is at dev time. But there's no free lunch. Maybe some day, but probably not within my career.

And that's fine, I now know that when the topic of cross-platform comes up to ask "what are we giving up? What will our new pain points be?" What I don't do anymore is think that this time will be different.

How would C++ work for cross-platform development? Would you use a framework like Qt, or write platform-specific frontends?
I second FlyingSnake.

It is easier to use straight C++, using a MVVM approach than Qt.

QML doesn't provide enough support for native UIs, so you end up spending time redoing native widgets on it.

Similarly Qt doesn't provide any bindings for the majority of mobile OS APIs, so you end up writing your own wrappers anyway.

In the end it is a bigger effort than using C++ libraries plus your own integration code.

Additionally in iOS and UWP, you get C++ extensions, Objective-C++ and C++/CX respectively, that make it quite easy to integrate with native APIs. Android is the outlier here with the JNI pain. Still Djinni and SafeJNI help to reduce the pain.

QT is one great option, however I've not used it so far.

I use Djinni IDL from Dropbox to create common logic in C++ and UI Specific code in iOS/Android. It's not at all beginner friendly and you need lot of patience with the setup.

Cons: complex build setup, and C++.

Pros: Blazing fast native performance, and you can easily write common business logic in c++

Start here is you wish to go that path:

http://mobilecpptutorials.com

What about React Native?
I've not tried RN, but a team I know tried it for a professional project. They were really dissatisfied with it said it's not suited for medium to heavy applications and found the performance sorely lacking. IIRC they mentioned that the toolchain is also not as great as Android Studio/Xcode. But YMMV.
I've several React Native apps in both appstores. I think while React Native is not suited for all types of apps, there is a sweet spot for certain projects where it really shines. The development speed is really unparalleled, with hot reloading you can see your app changes as soon as you hit 'save' in your editor.
what is the sweet spot? I'm faced with developing a fairly simple thing and it would help to know a little more about learning curve ( I use react ), downsides, etc.
Small to medium sized apps (not games) where you can sacrifice some UI polish to get them delivered quicker and on both platforms. Have a look here https://facebook.github.io/react-native/showcase.html If you know React, learning React Native would be pretty easy, plus you can use many of react libraries like redux, etc.
What problems did you experience with Rx? That's odd. Email is in my profile; can connect you with the core team.
Rx is a fantastic project and I've immense respect for the creators.

My problem wasn't with Rx but rather the way our project grew crazy huge with lots of inner cross platform components and app specific implementations. Add to it the customized libraries for Android/iOS. I believe VS is one of the best IDEs out there but still it couldn't cope up with it, and it made things tough for us. So thanks for your help, Rx is fine, it's just the situation we were caught in wasn't great :-)

Have you, or anyone else here, tried NativeScript? It has its own quirks, but I have been pretty satisfied with it so far. How does it scale in bigger projects?