I know this question asked many times on StackOverflow, But I already tried a lot of suggestions and tricks but not working the methods.
I got a progress update from SwiftEventBus
and I am trying to update ProgressView
like the below in UI.
SwiftEventBus.onMainThread(self, name: "fileUploadStart") { result in
self.progress = result?.object as! Float
self.init()
}
func init() {
if self.lastProgress != self.progress {
self.lastProgress = self.progress
let finalProgress = self.progress / 100.0
print("===progress===", finalProgress)
DispatchQueue.main.async {
self.progressBar.setProgress(finalProgress, animated: true)
// self.progressBar.progress = self.progress/100.0
}
}
}
I am uploading/downloading files from Google Drive
. When I am login with Gmail
for the first time, the progress has been not updated only once. If I go back and come to the same screen the ProgressView
start updating.
I don't know where I did the mistake. Please someone help me to fix this problem.