As you can see in the image below, I want the left (star) and right (sun) views’ backgrounds to fill their parent (HStack) without using GeometryReader or altering the HStack’s natural height.
struct FillParentTest: View {
var body: some View {
HStack(spacing: .zero) {
Image(systemName: "star")
.font(.title3)
.padding()
.background(.blue.opacity(0.5))
Image(systemName: "moon")
.resizable()
.frame(width: 80, height: 80)
.padding()
.frame(maxWidth: .infinity)
Image(systemName: "sun.min")
.font(.title3)
.padding()
.background(.pink.opacity(0.5))
}
.frame(maxWidth: .infinity)
.background(.yellow.opacity(0.5))
.clipShape(.capsule)
.padding(.horizontal)
}
}


