Live data from Hacker News

SwiftUI Defaults Considered Harmful

tonsky.me

31–40 of 135 posts

Re: SwiftUI Defaults Considered Harmful

#32
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.

You're right but it's a tradeoff I guess. It seems like they want to optimise for developers building half decent looking apps with adaptive UIs across their platforms with less effort.

Re: SwiftUI Defaults Considered Harmful

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

Actually this a very common practice for Apple and well known among seasoned devs. Apple’s shiny new things don’t really belong in production apps until a few major versions in. In my decade of iOS development experience prevailing wisdom has been that nothing has ever worked until at least a few major versions in and don’t belong in production apps unless you really love rewriting your entire codebase.

Good rule of thumb is an application usually needs to support at least one prior major iOS version and SwiftUI is only available on 13. Don’t know current adoption numbers but I believe there is still a significant % of users still on 12.

Just don’t be surprised when SwiftUI apps require major refactoring to work on iOS 14.

I haven’t even touched SwiftUI yet as I’m orders of magnitude more productive with RxSwift and every single realworld-ish example implementation I’ve seen makes my eyes bleed.

Re: SwiftUI Defaults Considered Harmful

#35
post #19

The “X considered harmful” trope for deliberately strident technical screeds that quibble about what are mainly niche concerns has tired me out. “‘X considered harmful’ considered harmful”, I guess.

You’re going to love this essay by Eric Meyers.

https://meyerweb.com/eric/comment/chech.html

Now I await “Comments linking to the ‘considered harmful essays considered harmful’ essay on ‘x considered harmful’ discussions considered harmful”.

Re: SwiftUI Defaults Considered Harmful

#36
post #7

This website's background color is considered harmful, and "considered harmful" essays are considered harmful.

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 know complaining about blog design is out of scope

In this case, considering the topic, such a complaint is really warranted. A set of sensible defaults for that blog would have made it more readable — the blog design is pretty much a rebuttal of the content.

Re: SwiftUI Defaults Considered Harmful

#40

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…

Surely JSX is ... well it's something that looks a lot like XML, hence the name. It's not just JavaScript, is it? It's pretty much the definition of embedding a DSL.

I've not used SwiftUI but I've used TornadoFX which is similar, but with Kotlin instead of Swift. There's no weird syntax or DSLs (even though they call it that). It's all just functions and lambdas, so the language is always there and the syntax is always consistent with what you use elsewhere. It's not like React/JSX where UI code syntactically looks different.

Post reply on HN