This is my code:
struct GameView : View {
@State
private var clicked1 : Bool = false
var body: some View {
HStack {
VStack {
Image("shape0")
.overlay(clicked1 ?
RoundedRectangle(cornerRadius:10)
.stroke(Color.yellow, lineWidth: 7) : pass()
)
.onTapGesure {
print("Image is clicked")
}
}
}
}
}
But some errors happen around pass().
I want to do nothing when variable clicked1 is false.
How can I fix it?