News for hackers. Stuff that matters.
Re:SwiftWebUI by pavlov on Monday July 01, 2019 @06:36AM (#20324045)
It's weird that there are 49 comments and not a single mention of React.

SwiftUI is basically React implemented in Apple's proprietary language rather than a preprocessed JavaScript-XML hybrid [1]. More options is a good thing, but it hardly seems revolutionary.

[1] This works much better than it sounds like. I'm a long-term C/C++/Obj-C programmer and was very sceptical of JSX, but React is actually very nice to use. The toolchain is kind of byzantine but seems to be settling slowly on reasonable defaults.

Re:SwiftWebUI by chrismorgan on Monday July 01, 2019 @11:53AM (#20326609)
> SwiftUI is basically React implemented in Apple's proprietary language rather than a preprocessed JavaScript-XML hybrid.

This is completely false. Not one shred of truth in it. The similarities between React and SwiftUI end at both being component-based UI libraries, just like plenty of others (Cocoa, Vue, Ember, Ext JS, Svelte, Qt, do I need to go on?—some of which provide various components out of the box, others of which don’t). Beyond that, they work in radically different ways and the way you will achieve things is radically different too. Just look at the avocado toast example and see how true this is.

Re:SwiftWebUI by pavlov on Monday July 01, 2019 @05:41PM (#20330023)
I honestly don't know what you mean. The SwiftUI avocado toast example looks very similar to React but very different from e.g. Cocoa or Qt.
Re:SwiftWebUI by chrismorgan on Monday July 01, 2019 @08:05PM (#20330939)
It looks more like React than the likes of Cocoa and Qt, but if you’re comparing that aspect of its style then it looks like at least Vue, Ember and Svelte too. The way it works is very different, and the way it’ll make you write code is fairly different too, inasmuch as it essentially has its own layout and rendering model, and doesn’t use HTML and CSS. (SwiftWebUI renders to HTML, but being SwiftUI stuff it’s not using HTML simply rather than that being what you work with in your UI code; and styling works in a radically different way.)
Re:SwiftWebUI by pavlov on Tuesday July 02, 2019 @05:21AM (#20333459)
React is independent of layout and rendering models, it's not in any way tied to HTML or CSS.

AFAICT the way SwiftUI works is basically the same as React.

Re:SwiftWebUI by ch_sm on Tuesday July 02, 2019 @08:06AM (#20334205)
You’re right in that it looks similar to React, but it is also true that this kind of API is (declarative component tree composition) now very wide-spread and popular, and React was not the first to implement or adopt it (I feel like the person referencing Qt maybe meant Qt Markup Language specifically).

The way all of these frameworks differ from each other is both very slight in superficial details (think two-way binding or slots) and very, very strong in the basic implementation (i.e. the diffing or reconciliation algorithm).

So, yes, a lot of these look similar these days. But saying that they work the same is oversimplification in my opinion.

Re:SwiftWebUI by chrismorgan on Tuesday July 02, 2019 @09:37AM (#20334808)
When I referred to Qt I was meaning Qt in general, rather than QML. If you want a similar style of how you write code, then yes, QML is closer to this area than general Qt.
Re:SwiftWebUI by chrismorgan on Tuesday July 02, 2019 @09:39AM (#20334823)
Yes, React is nominally independent of HTML and is independent of CSS. SwiftUI is not independent of these things, but implements its own thing altogether.
Re:SwiftWebUI by srfilipek on Monday July 01, 2019 @08:13AM (#20324508)
> Apple's proprietary language

While it is heavily funded and used by Apple, I would never call it "proprietary". It's open source.

https://swift.org/about/#swiftorg-and-open-source

Re:SwiftWebUI by pavlov on Monday July 01, 2019 @08:15AM (#20324522)
Apple makes all relevant decisions on language design and direction. Swift is Apple's proprietary language in the same sense as C# is Microsoft's.
Re:SwiftWebUI by ksec on Monday July 01, 2019 @10:14AM (#20325410)
But it is not proprietary.

By that definition, C#, Go, Java are all proprietary.

Re:SwiftWebUI by plopz on Monday July 01, 2019 @11:18AM (#20326175)
I certainly view C# and Go as proprietary.
Re:SwiftWebUI by yogthos on Monday July 01, 2019 @07:53AM (#20324412)
I find using React is a strictly better experience from ClojureScript. There's way less code, no JSX, the toolchain is straight forward, you get reliable hot loading for free, and it actually outperforms plain React in some cases.

https://github.com/ClojureTO/JS-Workshop

https://www.freecodecamp.org/news/a-realworld-comparison-of-...

Re:SwiftWebUI by andrekandre on Monday July 01, 2019 @07:21AM (#20324260)
well, to be fair, react wasn’t exactly completely new with its idea either... what’s old is new again
Re:SwiftWebUI by yogthos on Monday July 01, 2019 @07:51AM (#20324400)
Sure, but it is one of the most popular way to develop web apps today. So it seems kind of relevant to contrast against it.
Re:SwiftWebUI by ptx on Monday July 01, 2019 @04:33PM (#20329447)
Do you have examples of earlier systems based on the ideas that React popularized?