| ▲ | jbritton 2 days ago | ||||||||||||||||
I have often thought layouts should be done by a constraint solver. Then there could be libraries that help simplify specifying a layout, which feed constraints to the solver. | |||||||||||||||||
| ▲ | eurleif 2 days ago | parent | next [-] | ||||||||||||||||
Recently discussed on HN: https://news.ycombinator.com/item?id=46144039 | |||||||||||||||||
| ▲ | hansvm 2 days ago | parent | prev | next [-] | ||||||||||||||||
I've done that for desktop apps before. You have to be careful with the effects of sub-pixel rendering and whatnot if your math is continuous, but it's a viable path that I quite like. | |||||||||||||||||
| |||||||||||||||||
| ▲ | jacobp100 2 days ago | parent | prev [-] | ||||||||||||||||
iOS used to do this using the Cassowary constraint solver pre-SwiftUI. It’s the worst thing to work with. So much code turning on and off constraints, dynamically adding constraints when you have new views. And that’s before you get into conflicts | |||||||||||||||||