Why doesn't this simple view modifier work in iOS Swift Playgrounds on iPad Pro

This code doesn't seem to work correctly. It should spin a system image using a very simple view modifier. Am I doing anything wrong in the code ?


Code Block swift
import PlaygroundSupport
import SwiftUI
struct ContentView: View {
    var body: some View {
        Image(systemName: "timer")
            .spinning()
    }
}
struct Spinning: ViewModifier {
    @State var isVisible: Bool = false
    func body(content: Content) -> some View {
        content
            .rotationEffect( Angle(degrees:  isVisible ? 360 : 0 ))
            .animation(Animation.linear(duration: 1).repeatForever(autoreverses: false))
            .onAppear { isVisible = true }
    }
}
extension View {
    func spinning() -> some View {
        self.modifier(Spinning())
    }
}
PlaygroundPage.current.setLiveView( ContentView() )



This app used to be Amazing ... what happened on the last update ?
On Mac OX the code works fine, but if you
  • run it on the iPad Playgrounds, and

  • increase duration (i.e. to 4) and set autoreverse to true in line 18,

then you realize that there is a secondary animation which overlays the rotation.

Looks like a bug to me, or at least an inconsistency.
Why doesn't this simple view modifier work in iOS Swift Playgrounds on iPad Pro
 
 
Q