Live data from Hacker News

SwiftUI Defaults Considered Harmful

tonsky.me

21–30 of 135 posts

Re: SwiftUI Defaults Considered Harmful

#21
post #18

Observing the launch of SwiftUI as a bystander (I'm not developing for any Apple platform), it seems that people are very excited about SwiftUI, but also get burned by it a lot. This is mostly Apple's fault by releasing this framework without any caveats. But the framework is more like an early alpha, not to be used in production. Tooling is not yet ready, documentation is not yet ready, heck even Swift –the language…

I agree for the most part however I have put a simple app in the store with it and it works fine, it's usable for small apps. I had to wrap a few UIKit elements and a few other workarounds that I can't think of right now. But overall I'm happy they released it early and can benefit from the communities feedback and usage rather than building the whole thing in secret and releasing something finished that we might not even want. I hope that this is the beginning of them improving DX on their platforms as they have a lot of catching up to do to be competitive with other platforms.

Re: SwiftUI Defaults Considered Harmful

#22
> When fixing broken layout, it is always easier to add stuff that you forgot than removing stuff that your framework did for you and you that can’t see.

This paragraph reminded me of this old Jargon File koan:

---

In the days when Sussman was a novice, Minsky once came to him as he sat hacking at the PDP-6.

“What are you doing?”, asked Minsky.

“I am training a randomly wired neural net to play Tic-Tac-Toe” Sussman replied.

“Why is the net wired randomly?”, asked Minsky.

“I do not want it to have any preconceptions of how to play”, Sussman said.

Minsky then shut his eyes.

“Why do you close your eyes?”, Sussman asked his teacher.

“So that the room will be empty.”

At that moment, Sussman was enlightened.

Re: SwiftUI Defaults Considered Harmful

#23

I tried out SwiftUI a couple of months ago and it was buggy even when sticking to the standard Navigation components.. But now it seems like a lot of problems have been solved https://stackoverflow.com/questions/59279176/navigationlink-...

> even when sticking to the standard Navigation components. The standard navigation components have always been the buggiest part of UIKit. Don't even get me started on how UISearchController and UINavigationController interact on iOS 13…I have an app that's been sitting on the back burner, with full dark mode support, but unreleased for over six months because I haven't taken the time to figure out why the search ba…

Didn’t know this! Am very much an amateur with iOS development and thought that sticking with the Swift “happy path” would’ve been a good idea

Re: SwiftUI Defaults Considered Harmful

#24
post #7

Earlier quoted context omitted.

Site is also non-responsive with , looks horrifying on the 12.9’’ iPad Pro even without taking color scheme into account. I know complaining about blog design is out of scope, but if @tonsky is reading this thread, please consider fixing your meta viewport tag.

> I hope you have a wide enough monitor to read this. Perhaps they're merely unaware of how their website looks?

Yeah, I did think it was amusing reading that on my 27" 2550px wide monitor monitor that the site formatted it so narrowly. https://i.imgur.com/VG31Kpj.png

Re: SwiftUI Defaults Considered Harmful

#25
This is a very myopic view of UI development. The library is built to give you sane, well designed defaults that is lay together well when following the HIG, and which you should rarely attempt to override. Case in point, HStack, whose sole purpose is to stack items horizontally with proper spacing and is quite hard to achieve correctly on the web. If you want “dumb and explicit” why use a UI kit?

Re: SwiftUI Defaults Considered Harmful

#26

Earlier quoted context omitted.

> even when sticking to the standard Navigation components. The standard navigation components have always been the buggiest part of UIKit. Don't even get me started on how UISearchController and UINavigationController interact on iOS 13…I have an app that's been sitting on the back burner, with full dark mode support, but unreleased for over six months because I haven't taken the time to figure out why the search ba…

Didn’t know this! Am very much an amateur with iOS development and thought that sticking with the Swift “happy path” would’ve been a good idea

It's gotten better, it will probably work if you're not doing anything complicated. My view is set up from a five-year old storyboard and is dual UINavigationViews with UISearchControllers inside a UISplitView inside a UITabViewController :/ I'd still suggest sticking to the happy path, the other ones are even worse…

Re: SwiftUI Defaults Considered Harmful

#27
post #5

I tried out SwiftUI a couple of months ago and it was buggy even when sticking to the standard Navigation components.. But now it seems like a lot of problems have been solved https://stackoverflow.com/questions/59279176/navigationlink-...

I had this issue in the simulator but on my phone it seems fine. Not ideal obviously but it does work, I released a simple app with it earlier this year.

OMG you cannot know how many times some SwiftUI thing has worked fine on my iPhone but not on the simulator … that was simulating my iPhone model running my iOS version.

Re: SwiftUI Defaults Considered Harmful

#28
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…

The point isn’t that adaptative spacing does a good job most of the time, it’s that it’s doing things it isn’t telling you about in code and you “just need to know” for when it isn’t doing a good job.

Think about having to remember UI padding voodoo the couple days after you back from a vacation.

The UIkit shouldn’t try and hide language normal commas, it shouldn’t try and imply “smart” or “magic” padding.

Re: SwiftUI Defaults Considered Harmful

#30
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 similar for Swift and SwiftUI.

Post reply on HN