Hacker News new | past | comments | ask | show | jobs | submit
Maybe responsive layouts are part of the problem?

I get their appeal (in the sense of only having to develop one layout), but IMHO, in many cases more strict layouts would be the better choice.

You mention classic apps having a fixed layout, I think that's a good thing.

Not every user interfaces makes sense in portrait AND landscape mode for example.

And the slightly different sizes of iPhones are not really that problematic with something like autolayout.

Well, you can still have breakpoints, and switch between different structures for e.g. mobile vs desktop, or landscape vs portrait.

But I don't think you can cover all requirements with a set of fixed layouts, they do need to be somewhat flexible. Even if all screens were the same size, you'd want to be able to boost the font size for accessibility, and that essentially means scaling the whole UI.

And the slightly different sizes of iPhones are not really that problematic with something like autolayout.

I think something like flexbox is a better fit. There are tradeoffs in each approach, but I usually find a local, modular, bottom-up approach easier to work with than global constraint solving, even though it seems in principle like it should be nice to be able to say "keep this button here in relation to this other button". As you add more constraints like that your layout slowly turns to mush and doesn't actually resize nicely. (Edit to add: I'm probably conflating a few different generations of iOS toolkits here, I realise autolayout is somewhat separate from constraint-based layouts.)

I don't think it's a coincidence that most other UI toolkits have added something like flexbox (including iOS) -- it's not perfect but it fits how people generally think about UIs. Was HTML/CSS the first major UI framework to use flexboxes? That's how I remember it, but maybe it was copied from somewhere else.

> But I don't think you can cover all requirements with a set of fixed layouts, they do need to be somewhat flexible. Even if all screens were the same size, you'd want to be able to boost the font size for accessibility, and that essentially means scaling the whole UI.

Also, you want to localize apps, and different languages have /very/ different amounts of text for the same UI.

> And the slightly different sizes of iPhones are not really that problematic with something like autolayout

It can be problematic regardless of the technical solution, though generally I have to agree with the loudest voices on this thread: SwiftUI is a load of rubbish, UIKit and autolayout (and Interface Builder) was better.

Regarding problems with all layouts: I've got a 2022 model iPhone SE, so smallest screen, and every so often run into an app which just doesn't handle the screensize right. I've seen this happen as a developer with both UIKit and SwiftUI, it's just the type of bug you end up seeing is different.