import SwiftUI
struct GrowView: View {
var size:CGFloat = 400
@State var scale:CGFloat = 0
var body: some View {
HStack(alignment: .bottom) {
Rectangle()
.foregroundColor(.red)
.frame(height: 300 * scale)
.animation(.default)
if true {
Rectangle()
.foregroundColor(.red)
.frame(height: 400 * scale)
.animation(.default)
}
}.onAppear {
self.scale = 1
}.frame( maxHeight: 500, alignment: .bottom)
}
}
struct GrowView_Previews: PreviewProvider {
static var previews: some View {
GrowView()
}
}
Without the if block, the second Rectangle animates from bottom to top. When it is inside the If block however, it appears to draw from the top to bottom. What's going on?