Custom Alignment |

This is a companion discussion topic for the original entry at

Why isn’t the end result for the three HStacks (after implementation of customCenter) actually centered in the center of the original VStack? Wouldn’t the default “center” actually really be in the true center of that VStack instead of off to the right a bit?

1 Like

Great question!

The end result is centered. It just doesn’t fit within the hard-coded frame of the VStack.

Screen Shot 2020-09-12 at 11.30.14 AM

And if you’re questioning why the bottom Text isn’t in the center, check out the beginning of the previous video.

I do see that the three HStacks are centered relative to each other along the newly defined customCenters for the first two and the default center for the third stack , but I don’t understand how SwiftUI decides where to place the ENTIRE resulting VStack on the screen. Does it try to maximize the total amount of image that would have been within the initial VStack box?