Live data from Hacker News

Ask HN: What's the best library for making cross-platform UIs?

news.ycombinator.com

51–60 of 230 posts

Re: Ask HN: What's the best library for making cross-platform UIs?

#51
The choice of the UI library depends a lot on the type of app you're developing. For many types of apps, a single page HTML/JS/CSS app bundled as an executable is the best choice.

If your app will do a lot with the hardware (sound, video, networking,...), then you should look at native libraries for cross-platform hardware access and UI (though HTML/JS/CSS based UIs with native core are also possible).

In my experience, making a good "cross-platform" UI can be tricky, especially if your platforms include both desktop and mobile.

The reason is that each platform has it's own set of features, limitations and design requirements, which you either have to emulate, ignore or implement as platform-specific modules.

Most UI libraries implement their own windowing systems which makes it possible to have an app that behaves similarly on all platforms.

The drawback is that the app looks and feels 'cooked' - things aren't quite standard, animations are a bit off, fonts are rendered differently, etc.

One such example is Qt, which has been mentioned many times here. It is probably the best choice if pixel perfection and native look/feel isn't your primary requirement. With a bit of work you could probably achieve native 'perfection' with it too.

If you work with sound, then you should take a good look at JUCE - it has a very pleasant API, has a low overhead and a very friendly community.

That being said, the best choice IMHO is to develop native UIs for each platform or at least for the mobile versions of your app.

The trick is to separate your design into "core" and "ui" parts. The core is a cross platform C++ library, which implements all the business logic and low level hardware access, exposing an API to the UI layer.

The UI is then implemented in Qt/JUCE for the desktop apps, Objective-C++ and Swift for iOS (and OSX if you want) and Java+JNI on Android.

The advantage of this method is that it forces you to have clear separation of concerns between the core business and UI layers and you can have different people working on the core and the specific platform UIs.

The ultimate advantage is of course your user's experience - native apps are more gratifying.

It might sound like a lot more work, but it's usually not as bad as it sounds - if you have a well designed core API, the UI is just a visual representation of your application state, which is not that difficult to implement on each platform.

In the end, personal preference and tastes also matter - use whatever makes you (and your team) feel more comfortable. Good luck !

Re: Ask HN: What's the best library for making cross-platform UIs?

#53

Qt has a truly pleasant API and bindings in many languages. If you haven't used it before - and I know you haven't, otherwise you wouldn't be asking :) - give it a try. There's very little that's more cross-platform.

As a note, Qt doesn't handle DPI well, it seems. Qt apps are almost unusable on a Surface Pro 4.

Old versions of qt. Anything after 5.5 should be fine.

Re: Ask HN: What's the best library for making cross-platform UIs?

#54
I've been going the other direction recently. We have a photoshop plugin that exports layers with metadata (where an image is located, fonts, font sizes, text, etc). For any platform that has a basic scene graph and some sort of label functionality (Unity, iOS, android, theoretically even web) we write a runtime that converts the metadata into runtime UIs.

So it ends up being custom logic for interaction on each platform, but the design/assets can be shared cross-platform.

Re: Ask HN: What's the best library for making cross-platform UIs?

#55

Qt has a truly pleasant API and bindings in many languages. If you haven't used it before - and I know you haven't, otherwise you wouldn't be asking :) - give it a try. There's very little that's more cross-platform.

Qt's nice, but the thing I've always disliked about it is that it re-implements all these basic types, like QString, QVector, QList, QMap, etc. and you need to use them to interact with all their APIs. So, you either have to decide you're all-in on Qt and have these QThis and QThat types littered all over your code (making it more difficult to interact with other third party libraries like boost that know nothing abo…

Shouldn't you always have a layer between your business logic and display logic? Seems like this shouldn't be an issue with proper MVVM.

Re: Ask HN: What's the best library for making cross-platform UIs?

#56

Strange nobody mentioned wxWidgets so far which gives you true native apps, so I'll do it: http://wxwidgets.org It provides API layer which compiles to Win32 API on Windows, Gtk2 on Linux and Carbon/Cocoa on Mac OSX. Qt only emulates Windows controls, but wxWidgets uses the actual Windows controls via Microsoft Win32 API. BTW, there's wxQt, a wxWidgets implementation that uses Qt instead of Gtk, but it's still experi…

In my experience with it, wxwidgets has a very antiquated feeling to the API (I know, subjective) and it didn't ship high DPI support when I used it. Its Python bindings at the time felt rather unpythonic. Generally I wouldn't want to use this again.

Re: Ask HN: What's the best library for making cross-platform UIs?

#57
I'm barely a geek, let alone a hacker, but have been trying to learn NativeScript for the past month or so. You might want to check it out.

Not sure how it compares as a "library" or "framework" etc. I'm still figuring out where the lines are drawn.

http://docs.nativescript.org Emulator Here: https://docs.genymotion.com

Re: Ask HN: What's the best library for making cross-platform UIs?

#58
post #20

Earlier quoted context omitted.

Obsolete. Nowadays qt libs are distributed on choice between commercial and lgpl

Don't you have to release the source code of your application if you don't want to pay?

No. That's GPL, not LGPL.
Post reply on HN