You have to tell SwiftUI when and what to animate. Currently, you have a static symbol image that has been rotated 360°, but hasn't been told to animate. Applying the animation(_:value:) modifier doesn't start the animation; it just tells SwiftUI what animation to do when the value changes.
Something like this should work:
@State private var rotationAngle: Double = 0
var body: some View {
HStack {
Image(systemName: "arrow.clockwise")
.rotationEffect(.degrees(rotationAngle))
.animation(.linear(duration: 1.5).repeatForever(autoreverses: false), value: rotationAngle)
Text("Downloading ...")
}
.onAppear {
rotationAngle = 360
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: