Hi there! I want to change the current circle to a rectangle when I press the Right button. Is it possible if yes how can I it?
Here's the code:
struct ContentView: View {
@State var vOffset: CGFloat = 0
@State var hOffset: CGFloat = 0
var body: some View {
Circle()
.frame(width: 80, height: 80)
.position(x: 140 + hOffset, y: 140 + vOffset)
Spacer(minLength: 20)
Button(
action: {
vOffset += 20
}, label: {
Image(systemName: "arrowtriangle.down.circle.fill")
.resizable()
.foregroundColor(.blue)
.frame(width: 70, height: 70)
.padding()
}
)
Button(
action: {
hOffset += 20
}, label: {
Image(systemName: "arrowtriangle.right.circle.fill")
.resizable()
.foregroundColor(.blue)
.frame(width: 70, height: 70)
.padding()
}
)
}
}