Is this a bug or why does "white" get printed to console twice but "black" only once in the below code? If I take out the Text() call then it works like I expect (both onAppear modifiers only called once).
import SwiftUI
struct ContentView: View {
var body: some View {
ZStack {
Group {
Rectangle().fill(Color.black)
}
.onAppear() {print("black")}
Group {
Rectangle().fill(Color.white)
Text("black on white").foregroundColor(.black)
}
.onAppear() { print("white")}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}