Hacker News new | ask | show | jobs
by azeirah 3379 days ago
I remember that the Cassowary constraint system was implemented in Apple's app development framework, and people reporting that it was hell to work with after building anything beyond minimal complexity.

Also, there is an actual GSS implementation by thegrid.io

https://gridstylesheets.org/

3 comments

I've worked with Auto Layout a bit.

- The GUI built into Xcode is usable once you learn its quirks (e.g. how to swap the relationship in a constraint so that it doesn't say that the right edge of some button needs to be -5pt from the left edge of the button next to it).

- The ObjC/Swift API is bad.

- It handles RTL languages excellently: by default, constraints are expressed in terms of leading/trailing edges, but can be literal left/right if you want.

- It deals poorly with adding and removing views from a hierarchy: removing a view discards all of its constraints, so you need to have logic to reestablish them.

Unfortunately, there are horror stories about performance tanking with an OS update or taking on exponential properties, like this one which lead the team to develop a non-constraint-based layout framework:

https://realm.io/news/slug-nick-snyder-layoutkit/

It leads me to wonder if unpredictable performance is a limitation of constraint solving… or at least to be cautious with current implementations. Maybe an API that only makes known-fast relationships possible would help.

To be fair, the blame isn't on the Cassowary approach, but Xcode's god awful Interface Builder UI.
Ah, what a world that would have been!