I created a ProgressView
in SwiftUI (using Xcode) and edited a bit but haven’t figured out how to change its height.
struct ProgressBar: View {
var body: some View {
VStack {
ProgressView("Progres:", value: 50, total: 100)
}.foregroundColor(Color(UIColor.systemBlue))
.scaleEffect(1, anchor: .center)
.accentColor(Color(UIColor.systemGreen))
}
}
2
Answers
There’s no direct way that I know of to change the height, but you can use the
.scaleEffect
modifier. Make sure to specify1
for the x scale in order to only increase the height.Result:
A drawback to this is that you can’t pass in a Label, because it will also get stretched.
To work around this, just make your own
Text
above theProgressView
.I needed something with a more rounded radius and without concealing the ProgressView inside another View so here’s my take on it (extending @aheze ‘s answer by using the scale effect)