Making a Cross-Platform App in 2018
What does it take to make a cross platform (macOS, Linux, Windows, Android and iOS) application in 2018? Insanity, mostly. It’s a little bit nuts.
Read on for what I found while researching options for the upcoming Buckets mobile apps. Keep in mind that I have specific requirements that might not be your requirements.
tl;dr¶
My desktop app is currently in JavaScript. If I have to move away from JavaScript, I’d rather move up the portability continuum, not down. C is one of the most portable languages there is. But JavaScript is a safe bet—it isn’t going anywhere. So I’m going to try a combination of C (via Nim) and JavaScript.
Here are the top contenders ordered by my preference (though there are many, many more).
Framework | Desktop | Mobile | Language | Comment |
---|---|---|---|---|
Wiish | ⭐ | ⭐ | Nim + JS | I might spend more time working on Wiish than on Buckets if I go this route. But it’s fast and has great potential. If it doesn’t work out, I’ll also still have a portable C library. |
ReactNative | - | ⭐ | JS | I spent too much time digging into native Android/iOS (getting the right version of SQLite). I feel like the promise of easy will never actually be easy with this. If I have to spend a lot of time digging down into the native layer, I might as well just do a native app. I’m also doubtful about FB continuing to support it. |
Electron | ⭐ | - | JS | For desktop, this works fine. |
JUCE | ⭐ | ⭐ | C++ | If Wiish doesn’t work out, this is another favorite option, though the watermark in the free version is annoying. The lack of accessibility is also a problem. |
Flutter | - | ⭐ | Dart | I have high hopes for Flutter. Once it supports C libs through FFI, I’ll consider it. |
OpenFL | ⭐ | ⭐ | Haxe | This is great for games, but not so much for text-heavy productivity apps. |
webview | ⭐ | - | C | This could one day be a great alternative to Electron. It’s just missing some of the auxiliary features that make Electron shine. |
Android native | - | Android only | Java | Maximum flexibility on the platform. But Java… |
iOS native | - | iOS only | Swift/ObjC | Maximum flexibility on the platform. Good C integration. Might not be a bad idea. |
QT | ⭐ | ⭐ | C, QML | Licensing is too onerous for a single dev. Not even a real option. |
And here’s some subjective scoring:
- Accessibility - For those with disabilities
- Sunk Cost - If I choose this option, how much will I regret it if the project is abandoned or I otherwise want to use something else? Will I have to start over or will I get to use/port parts of what I’ve done?
- C Interop - How well does it integrate with C libraries (e.g. SQLite).
- JS Code Reuse - How much of my existing JS code do I get to reuse?
- Shared Code - How much of the code gets shared between platforms?
Framework | Accessibility | Sunk Cost | C Interop | JS Code Reuse | Shared Code |
---|---|---|---|---|---|
Wiish | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ |
ReactNative | ⭐ | ⭐ | meh | ⭐ | ⭐ |
Electron | ⭐ | ⭐ | meh | ⭐ | ⭐ |
JUCE | ❌ | meh | ⭐ | ❌ | ⭐ |
Flutter | ⭐ | ❌ | ❓ | ❌ | ⭐ |
OpenFL | ❓ | meh | ⭐ | ❌ | ⭐ |
webview | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ |
Android native | ⭐ | meh | meh | ❌ | ❌ |
iOS native | ⭐ | meh | ⭐ | ❌ | ❌ |
Detailed Blabbering¶
Wiish¶
Wiish is a Nim library that can make desktop or mobile apps. The UI layer is swappable, so you can use webviews (and JavaScript) or SDL2/OpenGL if that’s more your thing.
Pros:
- Can be speedy
- Very lightweight
- JavaScript reuse
- Generates C
- Nim is pleasant to use
Cons:
- Maintained by me :)
- Nim is pre v1
- A bit buggy at this point
ReactNative¶
ReactNative lets you use JavaScript to build native interfaces. It provides access to native APIs.
Pros:
- Speedy
- Native widgets
- JavaScript code reuse
Cons:
- Integrating with C libs is non-trivial
- Bug fixes not super speedy
- I don’t trust Facebook’s longevity
Electron¶
Electron has been a game-changer for desktop app development. You can write your application in JavaScript (including the never-ending JavaScript ecosystem):
Pros:
- Easy to get started quickly
- Built-in automatic updates
- Heavy code reuse (JavaScript, in this case)
Cons:
- Massive application file size
- Heavy memory consumption
- Lackluster speed in some cases
JUCE¶
JUCE includes a full IDE for making applications in C/C++. It has primarily been used for audio applications and is optimized for that case, but could be used for other types of application.
Pros:
- Great UI builder
- Very cross platform
- Speedy
- Some hot-reload capabilities for UI development
Cons:
- No accessibility
- You write in C++
- Licensing/cost
Flutter¶
Flutter is a Google project that has its own versions of native widgets. You use the Dart language.
Pros:
- Speedy
- Looks pleasant to use
- Hot code reload
Cons:
- Dart language. If I choose Dart, it won’t be easy to move to something else later.
- Google projects have short lives
- Lacks good C interop (but it’s coming!)
OpenFL¶
OpenFL is an open implementation of Flash and lets you write apps using the Haxe language (which compiles to C).
Pros:
- Very cross platform
- Haxe is a fun language
- Good C interoperability
Cons:
- Not great for text-heavy applications
- Some quirks involved in Flash API
webview¶
webview is a C library that provides you a window with a browser in it. There are various language bindings if you don’t want to write C.
Pros:
- Very lightweight
- JavaScript reuse
- Speedy
Cons:
- Browser differences
- Not feature complete yet
Android native¶
Pros:
- Full, unlayered access to APIs
- Good UI builder
Cons:
- Java
- Little to no code reuse for iOS app
iOS native¶
Pros:
- Full, unlayered access to APIs
- C interoperability is nice
- Great UI builder
Cons:
- Little to no code reuse for Android app
Conclusion¶
And here’s a little tease to end with :)
Comment below if you have had good success with other options for mobile/desktop app development.
Happy budgeting!
— Matt
Comments