There's no direct way that I know of to change the height, but you can use the .scaleEffect
modifier. Make sure to specify 1
for the x scale in order to only increase the height.
struct ContentView: View {
var body: some View {
ProgressBar()
.padding([.leading, .trailing], 10)
}
}
struct ProgressBar: View {
var body: some View {
VStack {
ProgressView(value: 50, total: 100)
.accentColor(Color.green)
.scaleEffect(x: 1, y: 4, anchor: .center)
}
}
}
Result:

A drawback to this is that you can't pass in a Label, because it will also get stretched.
ProgressView("Progress:", value: 50, total: 100)

To work around this, just make your own Text
above the ProgressView
.
struct ProgressBar: View {
var body: some View {
VStack(alignment: .leading) {
Text("Progress:")
.foregroundColor(Color.blue)
ProgressView(value: 50, total: 100)
.accentColor(Color.green)
.scaleEffect(x: 1, y: 4, anchor: .center)
}
}
}
