Ok I've made a little progress. In ContentView.swift, there is a section of code that is trying to display the "Export Finished" alert. But the "Export Progress" alert is still being displayed at 100%. I've put a comment in the code where I think there needs to be some statement to close the "Export Progress" popup. I have no idea of how to do that.
alert(isPresented: $showingAlert) {
switch alertReason {
... )
case .exportDone:
// need to close the previous alert for export progress!!!
return Alert(title: Text("Export finished"), message: nil, dismissButton: Alert.Button.default(Text("OK"), action: {
self.showingExportProgress = false
})) .sheet(isPresented: $showingExportProgress) {
ProgressPopup(isVisible: self.$showingExportProgress, title: Text("Exporting ..."), progressUpdateHandler: { () -> Float in
return self.exportProgressChecker?.progress ?? 0
})
}
The ProgressPopup is a struct:
struct ProgressPopup: View { ...
Questions:
-
Can I add a .close() function to the struct that would tell it to go away? What would it look like?
-
The ProgressPopup is displayed with this statement:
.sheet(isPresented: $showingExportProgress) {
ProgressPopup(isVisible: self.$showingExportProgress, title: Text("Exporting ..."), progressUpdateHandler: { () -> Float in
return self.exportProgressChecker?.progress ?? 0
})
}
But there doesn't seem to be a variable that saves a reference to it anywhere, so even if I could make a close() function from question 1, I would still need to be able to invoke the new function to close the popup.
Thanks to all for reading!