News for hackers. Stuff that matters.
Re:Inspecting Web Views in macOS by ketzo on Friday March 11, 2022 @10:16PM (#30648696)
As it turns out, React / CSS / the document-object-model are popular for more reasons than “it works on different computers.” Who knew!
Re:Inspecting Web Views in macOS by __del__ on Friday March 11, 2022 @10:38PM (#30648790)
who knew? it sneaked up on us.

we spent decades wedging compatibility shims into gaping functionality holes, while heroic visionaries of the web as a platform toiled and bargained to bring us the tools we needed for modularity, performance, and a modicum of basic platform services.

all while making sure <TD STYLE=FLOAT:RIGHT> continued to work.

Re:Inspecting Web Views in macOS by olliej on Friday March 11, 2022 @11:31PM (#30649014)
Apple has been using web views for apps for more than a decade - recognizing that such an object is more generally usable than just "a browser" was a motivation for WebView (now WKWebView) existing as a platform API from the earliest days of WebKit being a thing that existed (The logical extreme being the original WebView API exposed an objc interface to the DOM)
Re:Inspecting Web Views in macOS by chrismorgan on Saturday March 12, 2022 @04:48AM (#30650284)
And Windows pushed in this direction heavily back around 1999–2005, with things like https://en.wikipedia.org/wiki/HTML_Application and IE being used quite extensively in Windows Explorer in Windows XP and a couple of versions around it. (In fact, if it weren’t for the whole antitrust situation around the inclusion of IE, I suspect they would have gone even further in on web content on the desktop rather than letting it lie fallow for something like fifteen years.)

There’s a reason you get system colours and fonts in CSS: they’ve been round since the ’90s. You certainly wouldn’t get such useful and flexible stuff being added now.

There are very strong parallels in a lot of the progress that’s been happening in the past few years with what happened twenty years before. Probably the most obvious example is dark mode: computers had that twenty years before, then it got lost somewhere along the way, then it gets reinvented in an only slightly different form (both more and less useful: it’s far more restricted, to just one alternative theme rather than many, but for the web you can actually design for it in CSS alone this time).

Cycles.

Re:Inspecting Web Views in macOS by olliej on Saturday March 12, 2022 @05:26AM (#30650416)
My recollection of using the old windows HTML control was that it was very useful outside of being a basic content view - obviously there was subsequent additions to the web that made some functionality in webkit available, but the WebView controls in my extremely limited experience seemed a much better fit for minor content views in apps.

Of course that's all kind of moot because the important point is that there's a large different between a native app that uses a webview (or the windows/linux equivalent) to display some content, and a cut down browser view trying to act like a native application. Admittedly a number of the bugs in electron apps are a byproduct of their use of chromium which is very much a Mac-second engine and the actual API requires host apps to do much more work for system integration, which is a valid choice: it gives the host app much more flexibility in handling things. The down side is there are some things that apps shouldn't be trying to reimplement themselves.

Re:Inspecting Web Views in macOS by __del__ on Monday March 14, 2022 @12:35PM (#30674547)
that makes sense considering khtml, from which webkit evolved, was designed as a web view for the kde desktop environment.
Re:Inspecting Web Views in macOS by tonyedgecombe on Saturday March 12, 2022 @03:22AM (#30649905)
These pages are the least performant part of the preferences application.
Re:Inspecting Web Views in macOS by knome on Friday March 11, 2022 @10:30PM (#30648763)
I expect these additional reasons can largely be summed up as "I already know it from using it in the browser, so let's use that"
Re:Inspecting Web Views in macOS by inopinatus on Friday March 11, 2022 @10:51PM (#30648845)
I think it’s a little unfair that you’ve been so downvoted (at the time of writing), because the old phrase about hammers and nails is super applicable to software development, and the icloud team may very well know react better than cocoa.
Re:Inspecting Web Views in macOS by marcosdumay on Saturday March 12, 2022 @08:27AM (#30651175)
Actually, web pages are a very declarative GUI, with an amount of reflexivity and editability that should be on any declarative GUI framework, but normally isn't.

Those properties open up the possibility of abstracting things and making very powerful libraries over it. There is nothing else as powerful out there.

Yet, everybody stops at plain react. So whatever is the reason for the success, it's not that one I pointed.

Re:Inspecting Web Views in macOS by dymk on Friday March 11, 2022 @10:34PM (#30648776)
You'd probably be wrong!

Let me introduce you to https://github.com/ocornut/imgui

Re:Inspecting Web Views in macOS by junon on Friday March 11, 2022 @10:40PM (#30648805)
Which doesn't use React, CSS, or a DOM...? What's your point? ImGUI is imperative UI programming. DOMs are declarative.
Re:Inspecting Web Views in macOS by dymk on Friday March 11, 2022 @11:25PM (#30648987)
ImGui makes UI programming declarative in structure the exact same way React makes UI programming declarative.

React brings to the table is the general concept of immediate mode UI programming. So does ImGUI. Reaching for React doesn't mean it's the only thing the programmers knew, it means it's a general pattern that arises in UI programming.

Re:Inspecting Web Views in macOS by junon on Friday March 11, 2022 @11:39PM (#30649047)
No, it absolutely does not. ImGUI is a completely, totally different model of GUI programming.
Re:Inspecting Web Views in macOS by dymk on Saturday March 12, 2022 @10:04AM (#30651836)
Sorry, but they are the same concept. They’re both immediate mode GUI tools that provide a way to declaratively describe the UI in an imperative language.
Re:Inspecting Web Views in macOS by junon on Saturday March 12, 2022 @12:35PM (#30653057)
React is not immediate mode, imgui is not declarative.
Re:Inspecting Web Views in macOS by heavyset_go on Friday March 11, 2022 @11:42PM (#30649050)
I'd bet that the reason they're using React is because it's cheaper and easier to find front-end developers for the task.
Re:Inspecting Web Views in macOS by ketzo on Saturday March 12, 2022 @01:18AM (#30649378)
I’ve been hearing this on HN and similar forums for what feels like years now: “Electron/web-based GUIs are only popular because it’s easy to find devs in those ecosystems”

Have we considered asking why it’s so much easier to find React devs? Why such a huge, huge majority of UI development today takes place on the web?

I’m a front end web developer. I’m very biased.

But I’m a little tired of the narrative that “the right way to make a UI is to build it natively, but everyone wants to take the easy way out.”

Perhaps the explanation is that native GUI frameworks simply haven’t kept up in terms of developer experience. And if you spend some time exploring them, I think that becomes very obvious very quickly.

Re:Inspecting Web Views in macOS by kitsunesoba on Saturday March 12, 2022 @01:53AM (#30649504)
> Perhaps the explanation is that native GUI frameworks simply haven’t kept up in terms of developer experience.

That depends on what one values, in my opinion. Whenever I start poking around with front end web stuff it makes me want to tear my hair out. Not because it isn't technically capable, but it all feels so slapdash, duct-taped, and chaotic compared to what I'm used to writing AppKit/UIKit, even if some aspects of the experience with front end web tech are nicer. Things are solidifying around React which helps, but for me at least, it's still a hard sell to trade away the positive aspects of native development just to get the positive aspects of front end web dev.

Re:Inspecting Web Views in macOS by rhodysurf on Saturday March 12, 2022 @06:43AM (#30650720)
I’m guessing you haven’t tried building something serious with SwiftUI then. Because for me React is a million times more polished than SwiftUI.

I was a native dev before I got into web stuff. The Apple APIs for native GUIs are so good, but they are extremely verbose, and with swift now they are closed source. It’s just not as easy (or fun tbh) to build things with

Re:Inspecting Web Views in macOS by kitsunesoba on Saturday March 12, 2022 @08:37AM (#30651237)
SwiftUI is promising, but still green (for now). So no, I was talking about just plain old AppKit and UIKit. No fancy declarative syntax, but plenty capable.

Closed source isn’t great, but I’ll take that tradeoff for how much less frequently I need to reach for a third party library or write widgets from scratch.

Re:Inspecting Web Views in macOS by easrng on Saturday March 12, 2022 @01:53AM (#30649505)
Seriously, have you TRIED non-web, cross platform, UI dev? It's a nightmare. At least all the things I've tried so far are. I'm trying KDE's Qt IDE out and so far it seems much better at getting a working example built, though it looks like it's missing a visual interface editor. Qt-the-company had a good visual interface editor I used in ~2018 I think with PyQt but I can't find a way to launch it anymore. It's a mess.
Re:Inspecting Web Views in macOS by 0xabe on Saturday March 12, 2022 @05:13AM (#30650376)
Qt Designer[0] (for widget-based interfaces) is still a thing, and they have added Qt Quick[1] and Qt Quick Controls (for QML-based interfaces).

Recently they’ve been integrated into the IDE but with a right click on a file (within the IDE file browser or project browser panes) you can open a .ui file in the external Designer.

[0]: https://doc.qt.io/qt-5/qtdesigner-manual.html [1]: https://doc.qt.io/qt-5/qtquick-index.html

Re:Inspecting Web Views in macOS by munch117 on Saturday March 12, 2022 @06:45AM (#30650729)
I am insanely productive writing desktop applications with wxPython+wxWize. No GUI designer, no XML, just straight up Python code that's easy to follow and easy to refactor. I can whip up a prototype as fast as I ever could in Delphi, and it transitions cleanly into the finished app.

I guess if cross-platform needs to include mobile, then that's not good enough. But for what it does, I'm very happy with it.

Full disclosure: wxWize is my own creation.

Re:Inspecting Web Views in macOS by pjmlp on Saturday March 12, 2022 @03:13AM (#30649853)
I have, since the days of 16 bit home computers where when I wanted ultimate performance it had to code the core of the application in straight Assembly.

The only platform that offers native RAD like tooling for Web Development is OutSystems, most don't come even close, probably WebFlow.

Naturally since most devs don't like to pay for their tools, their target market is enterprise shops, so only Fortune 500 devs get nice tooling.

Re:Inspecting Web Views in macOS by xioxox on Saturday March 12, 2022 @05:04AM (#30650340)
The GUI designer is called Qt designer - it's called designer in Ubuntu/Debian. Unfortunately Debian has really made a mess of their packaging of Qt/PyQt. They've split up everything into tiny packages and their naming scheme seems crazy - I can never work out which package to install to get what I want. In this case it's qttools5-dev-tools.
Re:Inspecting Web Views in macOS by tonyedgecombe on Saturday March 12, 2022 @03:25AM (#30649914)
Some of us don't think much of Qt either.
Re:Inspecting Web Views in macOS by heavyset_go on Saturday March 12, 2022 @02:23AM (#30649648)
I have, and I found QtQuick and QML to be a better experience for reactive UI programming.
Re:Inspecting Web Views in macOS by dmitriid on Saturday March 12, 2022 @04:37AM (#30650234)
> Perhaps the explanation is that native GUI frameworks simply haven’t kept up in terms of developer experience.

Native UI toolkits are light years ahead of anything the web can offer in any forseeable future.

Well, WebGL is somewhat of an exception, but then you're literaly bringing native technologies with limitations into the web.

And one major exception: deployability. Nothing can beat the web in deployment.

Re:Inspecting Web Views in macOS by heavyset_go on Saturday March 12, 2022 @02:29AM (#30649672)
> Why such a huge, huge majority of UI development today takes place on the web?

Business models centered around the web, like the cloud and SaaS, and because it's the lowest common denominator when it comes to cross platform development.

> Perhaps the explanation is that native GUI frameworks simply haven’t kept up in terms of developer experience. And if you spend some time exploring them, I think that becomes very obvious very quickly.

QML works very nicely, it has a pleasant developer experience, it's reactive and declarative, and it even gives you JavaScript. It's similar to React in those regards, and I prefer it.

Re:Inspecting Web Views in macOS by linguae on Saturday March 12, 2022 @02:30AM (#30649678)
I believe the reason why so much UI development takes place on the Web is because there are a lot more people making websites and web applications than there are making desktop applications. For example, think of all of the businesses and institutions, big and small, that need a web presence. Because the Web is such an essential part of modern commerce, it makes sense that there would be much more work available for web UI development than for desktop UI development. In addition, the Web is quite possibly one of the easiest platforms to deploy an application. Want to reach much of the world? Spin up a cloud VM, get yourself a static IP and a domain name, deploy your web server, and voila!

Another thing to consider is that native app development is fragmented. For one, there are a variety of platforms. There are four major commercial platforms for consumers: Windows, macOS, Android, and iOS. In addition, each platform has multiple ways of doing native development. I don't know much about the Android ecosystem, but in Windows you have a choice between (off the top of my head) Win32, MFC, WPF, and WinRT (and I may have forgotten a few), on the Mac you have a choice between AppKit and SwiftUI, and on iOS there's UIKit vs SwiftUI. Thus, it's not enough just to hire a developer based on platform; it's important to hire based on experience with the API your application uses.

In my opinion, my negative opinion of Electron on the desktop has nothing to do with laziness. There has always been a tradeoff between developer convenience and optimal performance in software engineering; for example, this is why I write machine learning code in Python instead of fine-tuned assembly. If that's lazy, I'm guilty as charged. Rather, my negative opinion is based on these issues:

1. A disregard for conforming to the platform's UI/UX guidelines, which are in place to ensure consistency in behavior across applications. By Webifying the desktop we get rid of one of the strongest advantages of desktop operating systems, which is consistency across applications, and we turn the desktop into the inconsistent hodgepodge of user interfaces that make up the Web.

2. Accessibility problems that are caused by ignoring the native platform's accessibility APIs.

3. Performance issues caused by running instances of entire web browsers to duplicate UI rendering features that already come with the UI toolkit of the system.

4. Applications written with the Web in mind for the desktop often inappropriately use design elements that may make sense in a web browser but do not make sense on a desktop (this is related to #1).

Some would say that #1 has long been the reality for Windows and Linux long before Electron existed due to competing toolkits (especially in the Linux desktop world) and app-centric viewpoints from application vendors where the look-and-feel of an app trumps platform consistency concerns for branding reasons. I agree. However, some say we should shrug, give up the dream of consistency, and accept having inconsistent applications. I believe there should be more consistency between applications (in fact, I disagree with the notion of app-centric desktop computing in general and strongly favor a component-style model, but that's another debate for another time), and I believe one of the strongest selling points of the Mac is the high degree of consistency that existed among the platform's applications for decades. The move toward Webified desktop apps undermine this consistency, however, and that I believe undermines one of the big things that make the Mac special.

Re:Inspecting Web Views in macOS by tonyedgecombe on Saturday March 12, 2022 @03:28AM (#30649929)
>Thus, it's not enough just to hire a developer based on platform; it's important to hire based on experience with the API your application uses.

I don't think so. I'd hire an iOS developer for a macOS job. There is enough commonality for it to be an easy transition. It's the same on Windows, the Winforms app I work on has a ton of win32 calls and a smattering of XAML/WPF.

Re:Inspecting Web Views in macOS by dmitriid on Saturday March 12, 2022 @04:39AM (#30650246)
> I'd hire an iOS developer for a macOS job. There is enough commonality for it to be an easy transition.

No. No there isn't. As evidenced by the crappy Catalyst and other mobile ports that break all possible platform conventions on MacOS.

Yes, it might be easier, but not easy.

Re:Inspecting Web Views in macOS by tonyedgecombe on Monday March 14, 2022 @09:03AM (#30671919)
No. That's wrong. The fact that there are poor quality catalyst apps is neither here nor there. The tooling, languages and large parts of the frameworks are common or so similar that it doesn't matter. You can go straight from writing an iOS app to writing a Mac app without much friction at all. I know because I did it.