You can use the following code within If condition.
VStack(spacing: 0) {
VStack {
Text("Header")
}
.frame(maxHeight: 30.0)
Text("Detail")
.frame(maxHeight: .infinity)
}
.frame(maxWidth: .infinity)
.background(Color.white)
.cornerRadius(10.0)
.padding(.top, 20)
.transition(.move(edge: .bottom))
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/KxLKO.png
One more alternative is to place one of the subviews inside of an `HStack` and place a `Spacer()` after it:
struct ContentView : View {
var body: some View {
VStack(alignment: .leading) {
HStack {
Text("Title")
.font(.title)
.background(Color.yellow)
Spacer()
}
Text("Content")
.lineLimit(nil)
.font(.body)
.background(Color.blue)
Spacer()
}
.background(Color.red)
}
}
resulting in :
[![HStack inside a VStack][1]][1]
[1]: https://i.stack.imgur.com/T4QJb.png