I’ve the next SwiftUI code:
Rectangle()
.fill(Coloration.blue.opacity(0.5))
.body(width: 130)
.body(maxWidth: .infinity)
.background(Coloration.orange.opacity(0.5))
.padding()
.body(maxHeight:100)
Right here is the output.
Clearly it may be seen that the inside rectangle in blue has been positioned within the centre of outer rectangle. I attempted experimenting with the alignment of frames and may see alignment of inside rectangle can solely be modified by altering body alignment of outer rect as follows:
.body(maxWidth: .infinity, alignment: .trailing)
However nothing adjustments if I alter body alignment property of inside rectangle.
I wish to perceive this behaviour extra clearly — whether or not view is centred by default, and why inside body alignment modification adjustments nothing.