Circular Style Progress View

- 주로 언제 끝날지 모르는 진행상황 표시할 때 사용
if downloading {
ProgressView()
.scaleEffect(2, anchor: .center)
.tint(.red)
}
버튼 위에 표시하기

Button("Download") {
downloading = true
DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
downloading = false
}
}
.buttonStyle(.borderedProminent)
.overlay {
if downloading {
HStack {
ProgressView()
.tint(.white)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(.ultraThinMaterial)
.clipShape(RoundedRectangle(cornerRadius: 8))
}
}
Linear Type Progress View
- 작업의 수 파악 가능할 때 사용
- 완료 작업 수/전체 작업 수 방식으로 값 표시하면 됨.

ProgressView(value: progress) {
Label("Download", systemImage: "icloud.and.arrow.down")
} currentValueLabel: {
Text("\(progress)")
}
.padding()