/// In order for the interface to appear, both isPresented
must be true
/// and document
must not be nil
. When the operation is finished,
/// isPresented
will be set to false
before onCompletion
is called.
/// If the user cancels the operation, isPresented
will be set to false
and onCompletion
will not be called.
`public func fileExporter<D>(isPresented: Binding<Bool>, document: D?, contentType: UTType, defaultFilename: String? = nil, onCompletion: @escaping (_ result: Result<URL, Error>) -> Void) -> some View where D : FileDocument`
So we can observe change of isPresented
Binding
.onChange(of: DownloadManager.isShowingFileExporterForZip, perform: { newValue in
// If the user cancels the operation, `isPresented` will be set to `false`
if newValue == false {
DownloadManager.exportableZipDocument = nil
}
})