How to know if a .fileImporter/.fileExporter got dismissed?

Hello, everyone!

Is there a way to know if a .fileImporter of .fileExporter got dismissed? (The cancel button at the top right was pressed or the view was dismissed with a swipe down.)

Hello,

the value for isPresented is updated if it is cancelled.

.fileImporter(isPresented: Binding( get: {showFileImporter}, set: {active in showFileImporter = active; print("File import active=\(active)")}), allowedContentTypes: fileImportTypes, allowsMultipleSelection: fileImportMultipleFiles, onCompletion: { args in afterFileImportSelection(args) })

Unfortunately there seem to be a bug that this is not updated, when the dialog window is just swiped down (iOS 15)

Any update on this swipe-down bug?

/// 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
                }
 })
How to know if a .fileImporter/.fileExporter got dismissed?
 
 
Q