28 lines
738 B
Swift
28 lines
738 B
Swift
import SwiftUI
|
|
|
|
import Lottie
|
|
|
|
struct LottieRefreshIndicator: View {
|
|
let isAnimating: Bool
|
|
|
|
@Environment(\.accessibilityReduceMotion) private var accessibilityReduceMotion
|
|
|
|
var body: some View {
|
|
let animation = LottieView(animation: .named("pull-to-refresh"))
|
|
.configure(\.contentMode, to: .scaleAspectFit)
|
|
.resizable()
|
|
|
|
Group {
|
|
if accessibilityReduceMotion {
|
|
animation.currentFrame(1)
|
|
} else if isAnimating {
|
|
animation.looping()
|
|
} else {
|
|
animation.currentFrame(0)
|
|
}
|
|
}
|
|
.frame(maxWidth: SodaSpacing.s48, maxHeight: SodaSpacing.s48)
|
|
.accessibilityHidden(true)
|
|
}
|
|
}
|