Skip to content

Instantly share code, notes, and snippets.

@jacobsapps
Created April 17, 2025 08:54
Show Gist options
  • Save jacobsapps/cb7fce05e1190dc91a4901ecc7932b20 to your computer and use it in GitHub Desktop.
Save jacobsapps/cb7fce05e1190dc91a4901ecc7932b20 to your computer and use it in GitHub Desktop.
@State private var progress: Double = 0
@State private var showError: Bool = false
// ...
.task {
do {
for try await percentage in DownloadAPI.downloadStream() {
progress = percentage
}
} catch {
self.showError = true
}
}
.alert("Download Error", isPresented: $showError) {
Button("OK", role: .cancel) { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment