Skip to content

Instantly share code, notes, and snippets.

@amannayak0007
Created September 21, 2020 05:15
Show Gist options
  • Save amannayak0007/d75ea4cb3c8ebffe65af189898b5d9e5 to your computer and use it in GitHub Desktop.
Save amannayak0007/d75ea4cb3c8ebffe65af189898b5d9e5 to your computer and use it in GitHub Desktop.
Circular Progress View
import SwiftUI
struct ContentView: View {
@State var isLoading : Bool = false
var body: some View {
ZStack {
Color(.black).ignoresSafeArea(.all)
Circle()
.trim(from: 0, to: 0.37)
.stroke(Color.green, lineWidth: 15)
.frame(width: 100, height: 100, alignment: .center)
.rotationEffect(Angle(degrees: isLoading ? 0 : 360))
Text("Loading..")
.foregroundColor(.green)
.fontWeight(.bold)
.onAppear() {
withAnimation(Animation.linear(duration: 1.0).repeatForever(autoreverses: false)) {
isLoading.toggle()
}
}
}
}
}
@amannayak0007
Copy link
Author

Circular Progress View

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment