I want to create a view that appears like this:
The sq. is a view that I wish to usher in a containing view on this case the ZStack and I need the sq. view to be offset up in order that it will get clipped on the high by no matter quantity of offset I need. I’m having points undertaking this. The code I’ve now’s this:
VStack {
ZStack {
Coloration.pink
Rectangle()
.fill(.grey.opacity(0.6))
.aspectRatio(1, contentMode: .fill)
.padding(.horizontal, 100)
.padding(.backside, 80)
}
.aspectRatio(288/136, contentMode: .match)
.border(.yellow)
.clipped()
Spacer()
}
The difficulty right here is that .aspectRatio(288/136, contentMode: .match)
just isn’t revered and so every part is thrown off.
How can I draw a sq. subview that has a adverse Y offset within the ZStack if I need the ZStack to maintain the 288/136 ratio?