这是我的代码:
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")
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
但周围发生了一些错误pass()。
clicked1当变量为 时我不想做任何事情false。
我该如何修复它?