3 ms·
> It may not sound like much, but this was a lot of work. I spent days just thinking about this problem, trying to understand what is happening now and how to i
by peterkos 2y ago
> It may not sound like much, but this was a lot of work. I spent days just thinking about this problem, trying to understand what is happening now and how to improve it.
I find these kinds of problems the most fun and the most educational! I tried building a grid layout system from scratch in SwiftUI, and it was similarly tricky to map out:
- what the "ideal" behavior one expects is,
- what edge cases exist,
- how to handle the edge cases,
- maintaining ideal behavior while handling edge cases.
(It was tricky b/c SwiftUI lays out its children, then its parent -- so the parent needs to ask its children for its view size, and iterate and set rows/columns that way.)
Maybe because the problem seem simple, it is that much more fun to dig into. Some good ol' time with a whiteboard.