blob: e12a791bb9db682a1ed7941ee0ec11a19ab16313 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import SwiftUI
struct MullvadProgressViewStyle: ProgressViewStyle {
let size: CGFloat
init(size: CGFloat = 48) {
self.size = size
}
@State var isAnimating = false
func makeBody(configuration: Configuration) -> some View {
Image.mullvadIconSpinner
.resizable()
.frame(maxWidth: size, maxHeight: size)
.rotationEffect(.degrees(isAnimating ? 360 : 0))
.onAppear {
withAnimation(
.linear(duration: 0.6).repeatForever(autoreverses: false)
) {
isAnimating = true
}
}
}
}
#Preview {
ProgressView()
.progressViewStyle(MullvadProgressViewStyle())
.background(Color.mullvadBackground)
}
|