I have a simple view in SwiftUI. There's a variable called connectionState. It's set to true for testing.
@State var connectionState: Bool = true
@ViewBuilder
var body: some View {
ZStack(alignment: .bottomTrailing) {
if self.connectionState {
ConnectionStatusBar()
.padding(.bottom, -24.0)
.offset(x: 0.0, y: -75.0)
}
}
}
But the View is never shown. When I delete the condition it is shown as it should. Is it impossible to use if condition in ZStack?