Hacker News new | ask | show | jobs
by Sidnicious 3374 days ago
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.