import SwiftUI
struct ShadowedProgressViews: View {
var body: some View {
VStack {
ProgressView(value: 0.25)
}
.progressViewStyle(DarkBlueShadowProgressViewStyle())
}
}
struct DarkBlueShadowProgressViewStyle: ProgressViewStyle {
func makeBody(configuration: Configuration) -> some View {
ProgressView(configuration)
.shadow(color: Color(red: 0, green: 0, blue: 0.6),
radius: 4.0, x: 1.0, y: 2.0)
}
}
struct ContentView: View {
@State var processValue:CGFloat = 0
var body: some View {
VStack {
ProgressView(value: processValue * 0.01).progressViewStyle(LinearProgressViewStyle(tint: .green))
Spacer().frame(width: 10, height: 30, alignment: .center)
ProgressView().progressViewStyle(CircularProgressViewStyle(tint: .green))
Spacer().frame(width: 10, height: 30, alignment: .center)
ShadowedProgressViews()
Spacer().frame(width: 10, height: 30, alignment: .center)
ProgressView(value: processValue * 0.01).progressViewStyle(DarkBlueShadowProgressViewStyle())
}.onAppear() {
Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { atimer in
processValue += 1
if processValue > 100 {
processValue = 0
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}