4 ms·
My apologies, you've successfully passed FizzBuzz, in a rather unwieldy way by relying on nesting vstacks, hstacks and adding spacers. The larger point being -
by alexashka 4y ago
My apologies, you've successfully passed FizzBuzz, in a rather unwieldy way by relying on nesting vstacks, hstacks and adding spacers.
The larger point being - placing squares on a page went from drag and dropping and setting a few constraints, to now doing zstack/hstack/vstack/spacer wizardry.
- myko 4y ago> drag and dropping and setting a few constraints, to now doing zstack/hstack/vstack/spacer wizardry. Very few iOS developers I know did "drag and drop"/IB development, layouts are typically done in code even in UIKit. The zstack/hstack/vstack bits don't seem wizardy at all if you're used to looking at layouts in code.
- saagarjha 4y agoI think I'd ideally want to do this with some alignment constraints but I don't see this as being far more difficult than setting constraints manually. Doing this correctly is actually somewhat non-trivial because you'll want the square to respond to rotation appropriately, etc. which will require less-than-or-equal constraints.
- andrekandre 4y agoactually thats a good point i wonder how one could go about implementing custom layout in swiftui, something like `layoutSubViews` so we could implement something simplified like: View(layout: .grid) { ... } or View(layout: .stack(.vertical)) { ... }