Post

Replies

Boosts

Views

Activity

SwiftUI ProgressView styling
In watchOS I want to change the size and foreground color of a ProgressView. In Apple's example they use a separate struct to customize the appearance of the ProgressView. However I can't seem to resize the ProgressView beyond its default. I've tried using .frame with no luck. And .foregroundColor appears to have no effect as far as I can tell either. Has anyone had any luck customizing the new ProgressView with Xcode12 and SwiftUI 2.0? struct ContentView: View { @State private var progressAmount = 0.0 let timer = Timer.publish(every: 0.1, on: .main, in: .common).autoconnect() var body: some View { ProgressView("Progress…", value: progressAmount, total: 100) .progressViewStyle(DarkBlueShadowProgressViewStyle()) .progressViewStyle(CircularProgressViewStyle()) .onReceive(timer) { _ in if progressAmount < 100 { progressAmount += 2 } } } } 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) } }
3
1
18k
Jul ’20