
import SwiftUI
struct ContentView: View {
@State var isPressed = false
var body: some View {
HStack {
Button(action: {
isPressed.toggle()
}) {
Text("+")
.font(.largeTitle)
.padding()
.foregroundColor(.white)
.background(Color.green)
.clipShape(Circle())
.overlay(
Circle()
.stroke(Color.purple, lineWidth: 5)
)
}
.rotationEffect(isPressed ? Angle(degrees: 45) : .zero)
.animation(.linear)
Text("Spin!")
.font(.body)
.fontWeight(.black)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}