Live data from Hacker News

SwiftUI Defaults Considered Harmful

tonsky.me

71–80 of 135 posts

Re: SwiftUI Defaults Considered Harmful

#71

Reading through the syntax changes they made makes me really appreciate the decisions made around JSX and how that works, syntactically. It's just javascript , and none of these weird constructs need to be added into some DSL to support it. There's the reasonably minimal html-ish syntax, then "escape to javascript" to add in conditionals or loops or whatever. I wonder if there was (or still is) a way to do something…

It’s hard to claim that JSX is more “just JavaScript” than SwiftUI. If anything I’d say it’s the opposite. Swift evolved the language hand in hand with SwiftUI so everything you see is standard there. And in my humble opinion they did a knockout job. And this is coming from someone whose spent a ton of time evangelizing React. SwiftUI is far more beautiful, pleasant to write, and well thought out. It does have a coup…

> It’s hard to claim that JSX is more “just JavaScript” than SwiftUI. If anything I’d say it’s the opposite.

Yeah, that's fair. What I saw was that SwiftUI added special constructs to this DSL for if and ForEach statements, something which just isn't needed in JSX because it 'escapes' to JS fairly well.

Definitely think they did a pretty decent job of it - I couldn't have done better (and I can't judge whether a better job could have been done, I know next to nothing about Swift, hence my initial question), but it does strike me as unfortunate that they needed to specially re-create basic language features.

Re: SwiftUI Defaults Considered Harmful

#72
post #51

Just when I thought Lisp had been ransacked for every last feature that language designers were willing to steal, the "War on commas" pops up -- complete with discussion of the essential differences might exist between "(" and "{", the pain of needing another way to say "if", and the lack of support for the rest of the language. And the last couple interesting Swift libraries I saw had .gyb files and #if directives.…

many modern languages have macros: rust, crystal, elixir, nim not very corporate though, but getting there? with rust(mozilla a bit and others)

Re: SwiftUI Defaults Considered Harmful

#73

I was really excited about SwiftUI after having done a lot of React development recently. The declarative style is so much nicer than the MVC/procedural code that regular UIKit code becomes. After 30 minutes of updating Xcode I was able to start writing SwiftUI code. Then another 2 hours upgrading our Swift project to the latest version of Swift. I googled for documentation, found barely anything and the code samples…

I suspect Apple knows the developer experience for Swift is terrible (even if the Apple developer community at large is in mass denial about this).

The number 2 item on Swift Core Teams goals for Swift 6 is "Create a fantastic development experience". See: https://forums.swift.org/t/on-the-road-to-swift-6/32862

Whether anyone at Apple cares about documentation any more is another matter. A really sad state of affairs, because once upon a time, Apple had some of the best documentation out there. Of course, that was when they actively needed to court a developer community, and couldn't just announce something half-baked at WWDC and get mass adoption from enthusiastic developers.

Re: SwiftUI Defaults Considered Harmful

#76

I was really excited about SwiftUI after having done a lot of React development recently. The declarative style is so much nicer than the MVC/procedural code that regular UIKit code becomes. After 30 minutes of updating Xcode I was able to start writing SwiftUI code. Then another 2 hours upgrading our Swift project to the latest version of Swift. I googled for documentation, found barely anything and the code samples…

> ... after having done a lot of React development recently ... All this prompted me to finally give react-native a try. In under 15 minutes I had a working example.

The fact that you, a React developer with lots of experience with React were able to come up to speed vastly quicker on React Native shouldn't be surprising, that's a feature of the platform. You are the exact sort of person React Native was designed to make productive.

Of course you struggled, to pick up Swift UI, you needed to learn a new, vastly different language, and a new DSL that sits atop that language.

Even with good documentation and years of community expertise built up, this would have been an uphill comparison, but SwiftUI is relatively new—essentially in beta—there is very community around it and as you noticed, very little documentation... all of these last issues are pretty well known. All of them take time to overcome.

I'm not sure if SwiftUI is going to be the next big thing or not, but your comparison is a bit lopsided here.

Re: SwiftUI Defaults Considered Harmful

#77
post #73

I was really excited about SwiftUI after having done a lot of React development recently. The declarative style is so much nicer than the MVC/procedural code that regular UIKit code becomes. After 30 minutes of updating Xcode I was able to start writing SwiftUI code. Then another 2 hours upgrading our Swift project to the latest version of Swift. I googled for documentation, found barely anything and the code samples…

I suspect Apple knows the developer experience for Swift is terrible (even if the Apple developer community at large is in mass denial about this). The number 2 item on Swift Core Teams goals for Swift 6 is "Create a fantastic development experience". See: https://forums.swift.org/t/on-the-road-to-swift-6/32862 Whether anyone at Apple cares about documentation any more is another matter. A really sad state of affairs…

Even iOS programming communities will admit you're brave for using SwiftUI right now. It's brand new, has a lot of issues like being completely unable to show you a coherent type-error message (like if you have an error inside a ForEach view).

It's just cutting edge tech.

Re: SwiftUI Defaults Considered Harmful

#78
post #51

Just when I thought Lisp had been ransacked for every last feature that language designers were willing to steal, the "War on commas" pops up -- complete with discussion of the essential differences might exist between "(" and "{", the pain of needing another way to say "if", and the lack of support for the rest of the language. And the last couple interesting Swift libraries I saw had .gyb files and #if directives.…

Maybe Apple should embrace a Dylan variant again.

Re: SwiftUI Defaults Considered Harmful

#79

I was really excited about SwiftUI after having done a lot of React development recently. The declarative style is so much nicer than the MVC/procedural code that regular UIKit code becomes. After 30 minutes of updating Xcode I was able to start writing SwiftUI code. Then another 2 hours upgrading our Swift project to the latest version of Swift. I googled for documentation, found barely anything and the code samples…

> Oh and recompiling took a minimum of 30 seconds each time.

For a simple hello world SwiftUI app? I just checked a project I had open in xcode and it recompiled in under 1s. Thats on a mid range 2013 MBP.

> After making a change I saved the file, alt-tabbed to the simulator and the changes were already applied.

I guess Apple is aiming to get something like this experience through previews, which are a little broken right now.

Edit: formatting

Re: SwiftUI Defaults Considered Harmful

#80
post #16

There are definitely a few things it does that are weird, and this article hits on a few of them. But, I'll call special attention to the whole "adaptive padding thing" as a broader signal for something I feel that SwiftUI does very, very right and more UI frameworks need to start thinking about. Its made to design iOS apps. iOS has a design language that (1) is relatively consistent, (2) changes over time, and (3) c…

> When you release a poorly designed app to the App Store, the mistake is your's; your customers suffer because of it; and, it hurts the optics of application quality on the App Store, and thus Apple suffers.

Poor Apple. Poor customers. They are all entitled to perfectly 'designed' UIs which consistently showcase the majestic and breathtaking visual design of the Apple ecosystem. With they shadows, and the smooth animations, and the perfectly balanced padding. If only they could control what you see and what you can do with your Apple devices.

Oh wait. They do. And now we have to fight for the right to repair. And we have to fight for the definition of 'ownership'. And we have to fight against monopolies.

The argument that anything not controlled by Apple would hurt the optics of the ecosystem and damage Apple's brand / reputation / value has been used to diminish our rights in every possible way. But we have pretty UIs!

Post reply on HN