The approach has been tried, and succeeded to some degree. But the web is the only app where cross-platform is the default, and it's truly hard to avoid it. Even if the widgets all look different. Even if nothing looks native (people got used to it anyway).
And to be clear I want the status quo to improve in this regard, especially in terms of accessibility (nobody should have to reimplement eg their own dropdown especially if it breaks eg. keyboard shortcuts, mobile UIs and so on). But I can't see anything from today that isn't either a web technology, or web-compatible (and web-accessible, not the Qt webgl hack that's on the frontpage right now) making it in the long term.
Only Qt never had the funding or resources or will to get native UI right.
Their non-native widgets are always off, in a way that even Electron, is not (because it being web-based means it at least follows familiar conventions for all web users, where a mimicked native GUI enters the uncanny valley).
There are also custom native but not platform-native (meaning close to the metal, no web-based) GUIs like Adobes, Fruity Loops, and others, that look good on all platforms and users have no issues with them.
That's just because it describes its own embedded rendering system.
SwiftUI's syntax feels closer to a markup language than code, though, so it might be more appealing to web frontend devs.
No. Chrome is the only platform that is cross platform by default. But IE, eg, has definitely had behavior differences in the past.
On the other hand, Qt is cross language, but not necessarily cross platform (it excludes iPhone and Android, say)
Qt supports Android and iPhone.
That is what I'm talking about: SwiftUI automatically uses the recommended conventions for spacing, padding, etc. which are different for macOS vs. iOS etc., and it also takes user environment settings into account, like font sizes and other accessibility options.
The whole situation is bizarre and comical if you look at it from a distance:
Everybody ALREADY puts tremendous effort in making sure things look and work the same everywhere: Browsers!
Not just Apple, Google, Microsoft and Mozilla, but the thousands of third-party maintainers (like yes Electron) in this newly-created circle of Hel that is the JavaScript ecosystem.
And now we're trying to turn the browsers into operating systems!!
Everyone keeps trying to reinvent a wheel that doesn't travel very far to begin with (see all the missing features from web apps that native apps get, being discussed on this page.)
The visual and interactive differences between a macOS app and a Windows app are actually less stark than the differences between a macOS app and a watchOS app (crown) or a tvOS app (remote), but so far, despite its early bugs and limitations, SwiftUI does a great job of outputting the native controls on all [of Apple's] platforms.
Things like NavigationViews and TabViews produce different beasts on macOS, iOS, iPadOS, and tvOS, from the same code.
See WWDC 2019: SwiftUI On All Devices: https://developer.apple.com/videos/play/wwdc2019/240/
It's already amazing in how it abstracts common elements for such distinct environments like desktop, phone, TV and watch while still exposing OS-specific features. Why not other operating systems?