I have List with a button to download a file in each row. When I tap to download, the ProgressView
is showing in all rows, instead of of just one row, like shown in the picture below.
Here is my code:
List {
ForEach(0..<self.books.count, id: \.self) { index in
VStack {
let thisBook:Book = self.books [index]
Text (thisBook.name)
.font(.system(size: 22))
.listRowSeparator(.hidden)
Button(NSLocalizedString("Download", comment: "")) {
let downloadAudio = DownloadAudio()
downloadAudio.downloadBookId(Int32(thisBook.bookId),
testamentId: Int32(self.testamentId),
forLanguage: self.item.language)
{ String, progress, error in
self.progress = progress
print(progress)
}
}
.buttonStyle(.borderedProminent)
.controlSize(.large)
ProgressView(value: self.progress, total: 1.0).id(UUID())
}
}
.listRowSeparator(.hidden)
}
How do I fix this problem? Thanks in advance.