Hacker News new | ask | show | jobs
by api 1744 days ago
There is absolutely no reason we can't have a very good lightweight native UI compatibility layer.

Look at this heroic effort by a single developer:

https://github.com/andlabs/libui

It's not there, but it's probably too big of a project for one person.

3 comments

> It's not there, but it's probably too big of a project for one person.

I mean, just take a single subset of functionality like handling multi-touch input. It's probably an hour or two to read through the Pointer Events[1] spec until you get a better idea of why that API was designed the way it was. Now imagine coming up with such a design after at least dozens of hours studying the limitations of prior APIs (but probably more than that). And now, imagine either a) conceiving of and implementing that design (at least dozens of hours, probably way more), or b) cloning that design (still dozens of hours to implement).

Now compare to the minutes it takes to read a tutorial and start using the API in a browser that probably already runs on probably any modern device that has a screen.

That's just one cross-platform API, and probably not in the top ten to implement first.

1: https://w3c.github.io/pointerevents/

There have been many attempts to build such things, going back decades. None have really succeeded.

I am no expert, but my understanding is that it's easy to get to 75%, but extremely hard to get to 100%, or even 95%.

Not to mention that there are some differences between layout and navigation idioms on different platforms. Making an app truly native is not just a matter of using native widgets.

I do wonder if there is mileage in building an abstraction layer at a much higher level than a widget toolkit. Imagine being able to write a very abstract description of your app in some DSL, saying what screens it has, how they are linked, what information is on each one, and then having tools to compile that down to appropriate native code.

> None have really succeeded.

I don't think that "success" here is particularly well-defined. There are lots of Qt-based applications running on multiple platforms with a single codebase. That could easily meet a fairly strong definition of "success".

There are a million reasons. The main one being that you can't put the same UI on different platforms and have it fit in, no matter how well you use the native components.

The components are just one part of what makes up a UI. Different platforms have different conventions of how they are used on a higher level, and how everything fits into the rest of the platform UI.