ARTICLE AD BOX
I got something working with a mix of overlay and alignmentGuide (but still not ideal, cf comments below) :
ZStack { Rectangle() .fill(.blue) .frame(width: 100, height: 100) .overlay(alignment: .bottom) { VStack { Text("Title") Text("Subtitle") } .alignmentGuide(.bottom) { dimensions in dimensions[.top] } } }11.4k5 gold badges53 silver badges64 bronze badges
4 Comments
This only kind-of works, because the size of the overlay is constrained by the size of the view it is applied to, which is the size of the blue rectangle. The blocks in the overlay have a fixed size, so they force the VStack to overflow. But if you give the ZStack a border, you will see that it does not contain the overlay. Still, it might be sufficient as a solution for your purposes.
2026-02-23T16:57:59.897Z+00:00

