You forgot to add the value parameter to the third animation modifier.
struct ContentView: View {
@EnvironmentObject var oD: ObservableData
var body: some View {
Button(action: {
print("ButtonAction")
}){
Image(systemName: (oD.presetsSettings ? "checkmark.circle" : "gear"))
.frame(width: 20, height: 20)
.animation(.easeInOut(duration: 0.35).delay(0), value: oD.presetsSettings)
.rotationEffect((oD.presetsSettings ? .degrees(-10) : .degrees(80)))
.animation(.easeInOut(duration: 0.30), value: oD.presetsSettings)
.rotationEffect((oD.presetsSettings ? .degrees(-20) : .degrees(20)))
.animation(oD.presetsSettings ? .linear(duration: 0.15).repeatForever(autoreverses: true) : .linear(duration: 0.2), value: oD.presetsSettings)
}
Topic:
Programming Languages
SubTopic:
Swift
Tags: