ios – ProgressView showing in all items of List


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.

enter image description here

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.

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img